Class: QgsTableCell¶
Encapsulates the contents and formatting of a single table cell.
Added in version 3.12.
Methods
Returns the cell's background color, or an invalid color if a default color should be used for the background.  | 
|
Returns the column span for the cell.  | 
|
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   | 
|
Returns the properties of the cell.  | 
|
Returns the row span for 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, or   | 
|
Sets the properties for the cell.  | 
|
Sets the row and column span 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.  | 
- class qgis.core.QgsTableCell[source]¶
 Bases:
object- __init__(content: Any = None)
 Constructor for QgsTableCell, with the specified
content.- Parameters:
 content (Any = None)
- __init__(other: QgsTableCell)
 - Parameters:
 other (QgsTableCell)
- backgroundColor(self) QColor[source]¶
 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
- columnSpan(self) int[source]¶
 Returns the column span for the cell.
See also
See also
Added in version 3.40.
- Return type:
 int
- foregroundColor(self) QColor[source]¶
 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[source]¶
 Returns the horizontal alignment for text in the cell.
See also
See also
Added in version 3.16.
- Return type:
 Qt.Alignment
- numericFormat(self) QgsNumericFormat | None[source]¶
 Returns the numeric format used for numbers in the cell, or
Noneif no format is set.See also
- Return type:
 Optional[QgsNumericFormat]
- properties(self, context: QgsReadWriteContext) Dict[str, Any][source]¶
 Returns the properties of the cell.
See also
- Parameters:
 context (QgsReadWriteContext)
- Return type:
 Dict[str, Any]
- rowSpan(self) int[source]¶
 Returns the row span for the cell.
See also
See also
Added in version 3.40.
- Return type:
 int
- setBackgroundColor(self, color: QColor | Qt.GlobalColor)[source]¶
 Sets the cell’s background
color.Set an invalid
colorif a default color should be used for the background.See also
- Parameters:
 color (Union[QColor, Qt.GlobalColor])
- setForegroundColor(self, color: QColor | Qt.GlobalColor)[source]¶
 Sets the cell’s foreground
color.Set an invalid
colorif a default color should be used for the foreground.See also
- Parameters:
 color (Union[QColor, Qt.GlobalColor])
- setHorizontalAlignment(self, alignment: Qt.Alignment | Qt.AlignmentFlag)[source]¶
 Sets the horizontal
alignmentfor text in the cell.See also
See also
Added in version 3.16.
- Parameters:
 alignment (Union[Qt.Alignment, Qt.AlignmentFlag])
- setNumericFormat(self, format: QgsNumericFormat | None)[source]¶
 Sets the numeric
formatused for numbers in the cell, orNoneif no specific format is set.Ownership of
formatis transferred to the cell.See also
- Parameters:
 format (Optional[QgsNumericFormat])
- setProperties(self, properties: Dict[str, Any], context: QgsReadWriteContext)[source]¶
 Sets the
propertiesfor the cell.See also
- Parameters:
 properties (Dict[str, Any])
context (QgsReadWriteContext)
- setSpan(self, rowSpan: int, columnSpan: int)[source]¶
 Sets the row and column span for the cell.
See also
See also
Added in version 3.40.
- Parameters:
 rowSpan (int)
columnSpan (int)
- setTextFormat(self, format: QgsTextFormat)[source]¶
 Sets the cell’s text
format.Note
The text format will only be used if
hasTextFormat()returnsTrue.See also
Added in version 3.16.
- Parameters:
 format (QgsTextFormat)
- setVerticalAlignment(self, alignment: Qt.Alignment | Qt.AlignmentFlag)[source]¶
 Sets the vertical
alignmentfor text in the cell.See also
See also
Added in version 3.16.
- Parameters:
 alignment (Union[Qt.Alignment, Qt.AlignmentFlag])
- textFormat(self) QgsTextFormat[source]¶
 Returns the cell’s text format.
Note
The text format will only be used if
hasTextFormat()returnsTrue.See also
Added in version 3.16.
- Return type: