Class: QgsTableCell

class qgis.core.QgsTableCell(content: Any = None)

Bases: sip.wrapper

Constructor for QgsTableCell, with the specified content.

QgsTableCell(other: QgsTableCell) Copy constructor

Encapsulates the contents and formatting of a single table cell.

New in version 3.12.

Parameters

content

backgroundColor(self) → QColor

Returns the cell’s background color, or an invalid color if a default color should be used for the background.

Return type

QColor

content(self) → Any

Returns the cell’s content.

See also

setContent()

Return type

Any

foregroundColor(self) → QColor

Returns the cell’s foreground color, or an invalid color if a default color should be used for the foreground.

Return type

QColor

numericFormat(self)QgsNumericFormat

Returns the numeric format used for numbers in the cell, or None if no format is set.

Return type

QgsNumericFormat

properties(self, context: QgsReadWriteContext) → Dict[str, Any]

Returns the properties of the cell.

See also

setProperties()

Parameters

context (QgsReadWriteContext) –

Return type

Dict[str, Any]

setBackgroundColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the cell’s background color.

Set an invalid color if a default color should be used for the background.

Parameters

color (Union[QColor) –

setContent(self, content: Any)

Sets the cell’s content.

See also

content()

Parameters

content (Any) –

setForegroundColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the cell’s foreground color.

Set an invalid color if a default color should be used for the foreground.

Parameters

color (Union[QColor) –

setNumericFormat(self, format: QgsNumericFormat)

Sets the numeric format used for numbers in the cell, or None if no specific format is set.

Ownership of format is transferred to the cell.

See also

numericFormat()

Parameters

format (QgsNumericFormat) –

setProperties(self, properties: Dict[str, Any], context: QgsReadWriteContext)

Sets the properties for the cell.

See also

properties()

Parameters