Class: QgsLayoutTableColumn¶
Stores properties of a column for a QgsLayoutTable.
Some properties of a QgsLayoutTableColumn are applicable
only in certain contexts. For instance, the attribute and setAttribute
methods only have an effect for
QgsLayoutItemAttributeTables, and have no effect for
QgsLayoutItemTextTables.
Methods
Returns the attribute name or expression used for the column's values. |
|
Creates a duplicate column which is a deep copy of this column. |
|
Returns the horizontal alignment for a column, which controls the alignment used for drawing column values within cells. |
|
Returns the heading for a column, which is the value displayed in the column's header cell. |
|
Reads the column's properties from xml. |
|
Sets the attribute name or expression used for the column's values. |
|
Sets the horizontal alignment for a column, which controls the alignment used for drawing column values within cells. |
|
Sets the heading for a column, which is the value displayed in the column's header cell. |
|
Sets the sort rank for the column. |
|
Sets the sort order for the column. |
|
Sets the vertical alignment for a column, which controls the alignment used for drawing column values within cells. |
|
Sets the width for a column in mm. |
|
Returns the sort rank for the column. |
|
Returns the sort order for the column. |
|
Returns the vertical alignment for a column, which controls the alignment used for drawing column values within cells. |
|
Returns the width for the column in mm, or 0 if column width is automatically calculated. |
|
Writes the column's properties to xml for storage. |
- class qgis.core.QgsLayoutTableColumn[source]¶
Bases:
object- __init__(heading: str | None = '')
Constructor for QgsLayoutTableColumn.
- Parameters:
heading (Optional[str] = '') – column heading
- __init__(a0: QgsLayoutTableColumn)
- Parameters:
a0 (QgsLayoutTableColumn)
- attribute(self) str[source]¶
Returns the attribute name or expression used for the column’s values. This property is only used when the column is part of a
QgsLayoutItemAttributeTable.Note
only applicable when used in a
QgsLayoutItemAttributeTableSee also
- Return type:
str
- clone(self) QgsLayoutTableColumn | None[source]¶
Creates a duplicate column which is a deep copy of this column.
- Return type:
Optional[QgsLayoutTableColumn]
- Returns:
a new
QgsLayoutTableColumnwith same properties as this column.
Deprecated since version 3.14: Use a copy instead.
- hAlignment(self) Qt.AlignmentFlag[source]¶
Returns the horizontal alignment for a column, which controls the alignment used for drawing column values within cells.
See also
See also
- Return type:
Qt.AlignmentFlag
- heading(self) str[source]¶
Returns the heading for a column, which is the value displayed in the column’s header cell.
See also
- Return type:
str
- readXml(self, columnElem: QDomElement) bool[source]¶
Reads the column’s properties from xml.
- Parameters:
columnElem (QDomElement) – a QDomElement holding the column’s desired properties.
See also
- Return type:
bool
- setAttribute(self, attribute: str | None)[source]¶
Sets the
attributename or expression used for the column’s values. This property is only used when the column is part of aQgsLayoutItemAttributeTable.Note
only applicable when used in a
QgsLayoutItemAttributeTableSee also
- Parameters:
attribute (Optional[str])
- setHAlignment(self, alignment: Qt.AlignmentFlag)[source]¶
Sets the horizontal
alignmentfor a column, which controls the alignment used for drawing column values within cells.See also
See also
- Parameters:
alignment (Qt.AlignmentFlag)
- setHeading(self, heading: str | None)[source]¶
Sets the
headingfor a column, which is the value displayed in the column’s header cell.See also
- Parameters:
heading (Optional[str])
- setSortByRank(self, rank: int)[source]¶
Sets the sort
rankfor the column. If the sort rank is > 0 then the column will be sorted in the table. The sort rank specifies the priority given to the column when the table is sorted by multiple columns, with lower sort ranks having higher priority. This property is only used when the column is part of aQgsLayoutItemAttributeTable. If the sortrankis <= 0 then the column is not being sorted.Note
only applicable when used in a
QgsLayoutItemAttributeTableSee also
See also
Deprecated since version 3.14: The order is now hold in a dedicated model.
- Parameters:
rank (int)
- setSortOrder(self, order: Qt.SortOrder)[source]¶
Sets the sort
orderfor the column. This property is only used when the column is part of aQgsLayoutItemAttributeTableand whensortByRank()is > 0.Note
only applicable when used in a
QgsLayoutItemAttributeTableSee also
See also
- Parameters:
order (Qt.SortOrder)
- setVAlignment(self, alignment: Qt.AlignmentFlag)[source]¶
Sets the vertical
alignmentfor a column, which controls the alignment used for drawing column values within cells.See also
See also
- Parameters:
alignment (Qt.AlignmentFlag)
- setWidth(self, width: float)[source]¶
Sets the width for a column in mm. Set the
widthto 0 if the column width is to be automatically calculated.See also
- Parameters:
width (float)
- sortByRank(self) int[source]¶
Returns the sort rank for the column. If the sort rank is > 0 then the column will be sorted in the table. The sort rank specifies the priority given to the column when the table is sorted by multiple columns, with lower sort ranks having higher priority. This property is only used when the column is part of a
QgsLayoutItemAttributeTable.If sort rank is <= 0 then the column is not being sorted.
Note
only applicable when used in a
QgsLayoutItemAttributeTableSee also
See also
Deprecated since version 3.14: The order is now hold in a dedicated model.
- Return type:
int
- sortOrder(self) Qt.SortOrder[source]¶
Returns the sort order for the column. This property is only used when the column is part of a
QgsLayoutItemAttributeTableand when sortByRank is > 0.Note
only applicable when used in a
QgsLayoutItemAttributeTableSee also
See also
- Return type:
Qt.SortOrder
- vAlignment(self) Qt.AlignmentFlag[source]¶
Returns the vertical alignment for a column, which controls the alignment used for drawing column values within cells.
See also
See also
- Return type:
Qt.AlignmentFlag
- width(self) float[source]¶
Returns the width for the column in mm, or 0 if column width is automatically calculated.
See also
- Return type:
float
- writeXml(self, columnElem: QDomElement, doc: QDomDocument) bool[source]¶
Writes the column’s properties to xml for storage.
- Parameters:
columnElem (QDomElement) – an existing QDomElement in which to store the column’s properties.
doc (QDomDocument) – QDomDocument for the destination xml.
See also
- Return type:
bool