Class: QgsLayoutItemManualTable

A layout table subclass that displays manually entered (and formatted) content.

Added in version 3.12.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: QgsLayoutTable.getTableContents()

Class Hierarchy

Inheritance diagram of qgis.core.QgsLayoutItemManualTable

Base classes

QgsLayoutTable

Displays a table in the print layout, and allows the table to span over multiple frames.

QgsLayoutMultiFrame

Abstract base class for layout items with the ability to distribute the content to several frames (QgsLayoutFrame items).

QgsLayoutObject

A base class for objects which belong to a layout.

QObject

QgsExpressionContextGenerator

Abstract interface for generating an expression context.

QgsLayoutUndoObjectInterface

Interface for layout objects which support undo/redo commands.

Methods

columnWidths

Returns the list of column widths (in millimeters) to use when rendering the table.

headers

Returns a reference to the list of headers shown in the table

includeTableHeader

Returns True if the table includes a header row.

rowHeights

Returns the list of row heights (in millimeters) to use when rendering the table.

setColumnWidths

Sets the list of column widths (in millimeters) to use when rendering the table.

setHeaders

Replaces the headers in the table with a specified list of QgsLayoutTableColumns.

setIncludeTableHeader

Sets whether the table includes a header row.

setRowHeights

Sets the list of row heights (in millimeters) to use when rendering the table.

setTableContents

Sets the contents of the table.

tableContents

Returns the contents of the table.

Static Methods

create

Returns a new QgsLayoutItemManualTable for the specified parent layout.

class qgis.core.QgsLayoutItemManualTable[source]

Bases: QgsLayoutTable

__init__(layout: QgsLayout | None)

Constructor for QgsLayoutItemManualTable, attached to the specified layout.

Ownership is transferred to the layout.

Parameters:

layout (Optional[QgsLayout])

columnWidths(self) List[float]

Returns the list of column widths (in millimeters) to use when rendering the table.

A width of 0 indicates that the column width should be automatically calculated.

See also

rowHeights()

Return type:

List[float]

static create(layout: QgsLayout | None) QgsLayoutItemManualTable | None[source]

Returns a new QgsLayoutItemManualTable for the specified parent layout.

Parameters:

layout (Optional[QgsLayout])

Return type:

Optional[QgsLayoutItemManualTable]

headers(self) List[QgsLayoutTableColumn]

Returns a reference to the list of headers shown in the table

See also

setHeaders()

Return type:

List[QgsLayoutTableColumn]

includeTableHeader(self) bool[source]

Returns True if the table includes a header row.

Return type:

bool

rowHeights(self) List[float]

Returns the list of row heights (in millimeters) to use when rendering the table.

A height of 0 indicates that the row height should be automatically calculated.

See also

setRowHeights()

See also

columnWidths()

Return type:

List[float]

setColumnWidths(self, widths: Iterable[float])[source]

Sets the list of column widths (in millimeters) to use when rendering the table.

A width of 0 indicates that the column width should be automatically calculated.

See also

columnWidths()

Parameters:

widths (Iterable[float])

setHeaders(self, headers: Iterable[QgsLayoutTableColumn])[source]

Replaces the headers in the table with a specified list of QgsLayoutTableColumns.

See also

headers()

Parameters:

headers (Iterable[QgsLayoutTableColumn])

setIncludeTableHeader(self, included: bool)[source]

Sets whether the table includes a header row.

Parameters:

included (bool)

setRowHeights(self, heights: Iterable[float])[source]

Sets the list of row heights (in millimeters) to use when rendering the table.

A height of 0 indicates that the row height should be automatically calculated.

See also

rowHeights()

Parameters:

heights (Iterable[float])

setTableContents(self, contents: Any)[source]

Sets the contents of the table.

See also

tableContents()

Parameters:

contents (Any)

tableContents(self) Any[source]

Returns the contents of the table.

See also

contents()

Return type:

Any