Class: QgsTableCell¶
- class qgis.core.QgsTableCell¶
Bases:
sip.wrapper
Encapsulates the contents and formatting of a single table cell.
New in version 3.12.
QgsTableCell(content: Any = None) Constructor for
QgsTableCell
, with the specifiedcontent
.QgsTableCell(other:
QgsTableCell
) Copy constructorMethods
Returns the cell's background color, or an invalid color if a default color should be used for the background.
Returns the cell's content.
Returns the cell's foreground color, or an invalid color if a default color should be used for the foreground.
Returns the horizontal alignment for text in the cell.
Returns the numeric format used for numbers in the cell, or
None
if no format is set.Returns the properties of the cell.
Sets the cell's background
color
.Sets the cell's
content
.Sets the cell's foreground
color
.Sets the horizontal
alignment
for text in the cell.Sets the numeric
format
used for numbers in the cell, orNone
if no specific format is set.Sets the
properties
for the cell.Sets the cell's text
format
.Sets the vertical
alignment
for text in the cell.Returns the cell's text format.
Returns the vertical alignment for text in the cell.
- backgroundColor(self) QColor ¶
Returns the cell’s background color, or an invalid color if a default color should be used for the background.
See also
- Return type
QColor
- content(self) Any ¶
Returns the cell’s content.
See also
- 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.
See also
- Return type
QColor
- horizontalAlignment(self) Qt.Alignment ¶
Returns the horizontal alignment for text in the cell.
See also
See also
New in version 3.16.
- Return type
Qt.Alignment
- numericFormat(self) QgsNumericFormat ¶
Returns the numeric format used for numbers in the cell, or
None
if no format is set.See also
- Return type
- properties(self, context: QgsReadWriteContext) Dict[str, Any] ¶
Returns the properties of the cell.
See also
- 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.See also
- Parameters
color (Union[QColor) –
- setContent(self, content: Any)¶
Sets the cell’s
content
.See also
- 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.See also
- Parameters
color (Union[QColor) –
- setHorizontalAlignment(self, alignment: Union[Qt.Alignment, Qt.AlignmentFlag])¶
Sets the horizontal
alignment
for text in the cell.See also
See also
New in version 3.16.
- Parameters
alignment (Union[Qt.Alignment) –
- setNumericFormat(self, format: QgsNumericFormat)¶
Sets the numeric
format
used for numbers in the cell, orNone
if no specific format is set.Ownership of
format
is transferred to the cell.See also
- Parameters
format (QgsNumericFormat) –
- setProperties(self, properties: Dict[str, Any], context: QgsReadWriteContext)¶
Sets the
properties
for the cell.See also
- Parameters
properties (Dict[str) –
context (QgsReadWriteContext) –
- setTextFormat(self, format: QgsTextFormat)¶
Sets the cell’s text
format
.Note
The text format will only be used if
hasTextFormat()
returnsTrue
.See also
New in version 3.16.
- Parameters
format (QgsTextFormat) –
- setVerticalAlignment(self, alignment: Union[Qt.Alignment, Qt.AlignmentFlag])¶
Sets the vertical
alignment
for text in the cell.See also
See also
New in version 3.16.
- Parameters
alignment (Union[Qt.Alignment) –
- textFormat(self) QgsTextFormat ¶
Returns the cell’s text format.
Note
The text format will only be used if
hasTextFormat()
returnsTrue
.See also
New in version 3.16.
- Return type
- verticalAlignment(self) Qt.Alignment ¶
Returns the vertical alignment for text in the cell.
See also
See also
New in version 3.16.
- Return type
Qt.Alignment