QgsLayoutItemTextTable class

A text table item that reads text from string lists.

Base classes

class QgsLayoutTable
A class to display a table in the print layout, and allow the table to span over multiple frames.

Public static functions

static auto create(QgsLayout* layout) -> QgsLayoutItemTextTable*
Returns a new QgsLayoutItemTextTable for the specified parent layout.

Constructors, destructors, conversion operators

QgsLayoutItemTextTable(QgsLayout* layout)
Constructor for QgsLayoutItemTextTable, for the specified layout.

Public functions

void addRow(const QStringList& row)
Adds a row to the table.
auto displayName() const -> QString override
Returns the multiframe display name.
auto getTableContents(QgsLayoutTableContents& contents) -> bool override
Fetches the contents used for the cells in the table.
void setContents(const QVector<QStringList>& contents)
Sets the contents of the text table.
auto type() const -> int override
Returns unique multiframe type id.

Function documentation

QgsLayoutItemTextTable::QgsLayoutItemTextTable(QgsLayout* layout)

Constructor for QgsLayoutItemTextTable, for the specified layout.

Ownership is transferred to the layout.

void QgsLayoutItemTextTable::addRow(const QStringList& row)

Adds a row to the table.

Parameters
row list of strings to use for each cell's value in the newly added row

bool QgsLayoutItemTextTable::getTableContents(QgsLayoutTableContents& contents) override

Fetches the contents used for the cells in the table.

Parameters
contents QgsLayoutTableContents to store retrieved row data in
Returns true if table contents were successfully retrieved.

void QgsLayoutItemTextTable::setContents(const QVector<QStringList>& contents)

Sets the contents of the text table.

Parameters
contents list of table rows