Subgroup: Layout

Class: QgsLayoutItemTextTable

class qgis.core.QgsLayoutItemTextTable

Bases: qgis._core.QgsLayoutTable

A text table item that reads text from string lists

New in version 3.0: Methods

addFrame Adds a frame to the multiframe.
addRow Adds a row to the table
backgroundColor Returns the color used for the background of the table.
beginCommand Starts new undo command for this item.
blockSignals
calculateMaxColumnWidths
calculateMaxRowHeights
cancelCommand Cancels the current item command and discards it.
cellMargin Returns the margin distance between cell borders and their contents in mm.
cellStyle Returns the cell style for a cell group.
childEvent
children
columns Returns a reference to the list of QgsLayoutTableColumns shown in the table
connectNotify
contentFont Returns the font used to draw text in table body cells.
contentFontColor Returns the color used to draw text in table body cells.
contents Returns the current contents of the table.
contentsContainsRow
create Returns a new QgsLayoutItemTextTable for the specified parent layout.
createCommand
createExpressionContext Creates an expression context relating to the objects’ current state.
createNewFrame Creates a new frame and adds it to the multi frame and layout.
customEvent
customProperties Return list of keys stored in custom properties for the object.
customProperty Read a custom property from the object.
dataDefinedProperties Returns a reference to the object’s property collection, used for data defined overrides.
deleteFrames Removes and deletes all child frames.
deleteLater
disconnect
disconnectNotify
displayName
drawHorizontalGridLines
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
emptyTableBehavior Returns the behavior mode for empty tables.
emptyTableMessage Returns the message for empty tables with no content rows.
endCommand Completes the current item command and push it onto the layout’s undo stack.
event
eventFilter
finalizeRestoreFromXml Called after all pending items have been restored from XML.
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
findNearbyPageBreak Finds the optimal position to break a frame at.
fixedFrameSize
frame Returns the child frame at a specified index from the multiframe.
frameCount Returns the number of frames associated with this multiframe.
frameIndex Returns the index of a frame within the multiframe.
frames Returns a list of all child frames for this multiframe.
getTableContents
gridColor Returns the color used for grid lines in the table.
gridStrokeWidth Returns the width of grid lines in the table in mm.
headerFont Returns the font used to draw header text in the table.
headerFontColor Returns the color used to draw header text in the table.
headerHAlignment Returns the horizontal alignment for table headers.
headerMode Returns the display mode for headers in the table.
horizontalGrid Returns whether the grid’s horizontal lines are drawn in the table.
icon Returns the item’s icon.
inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
layout Returns the layout the object is attached to.
metaObject
minFrameSize
moveToThread
objectName
parent
property
propertyDefinitions Returns the layout object property definitions.
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
readObjectPropertiesFromElement
readPropertiesFromElement
readXml Sets the item state from a DOM element.
recalculateFrameRects Forces a recalculation of all the associated frame’s scene rectangles.
recalculateFrameSizes
recalculateTableSize
receivers
refresh
refreshAttributes Refreshes the contents shown in the table by querying for new data.
refreshDataDefinedProperty Refreshes a data defined property for the multi frame by reevaluating the property’s value and redrawing the item with this new value.
removeCustomProperty Remove a custom property from the object.
removeEventFilter
removeFrame Removes a frame by index from the multiframe.
render
resizeMode Returns the resize mode for the multiframe.
rowRange
rowsVisible
sender
senderSignalIndex
setBackgroundColor Sets the color used for background of table.
setCellMargin Sets the margin distance in mm between cell borders and their contents.
setCellStyle Sets the cell style for a cell group.
setColumns Replaces the columns in the table with a specified list of QgsLayoutTableColumns.
setContentFont Sets the font used to draw text in table body cells.
setContentFontColor Sets the color used to draw text in table body cells.
setContents Sets the contents of the text table.
setCustomProperty Set a custom property for the object.
setDataDefinedProperties Sets the objects’s property collection, used for data defined overrides.
setEmptyTableBehavior Sets the behavior mode for empty tables with no content rows.
setEmptyTableMessage Sets the message for empty tables with no content rows.
setGridColor Sets the color used for grid lines in the table.
setGridStrokeWidth Sets the width in mm for grid lines in the table.
setHeaderFont Sets the font used to draw header text in the table.
setHeaderFontColor Sets the color used to draw header text in the table.
setHeaderHAlignment Sets the horizontal alignment for table headers.
setHeaderMode Sets the display mode for headers in the table.
setHorizontalGrid Sets whether the grid’s horizontal lines should be drawn in the table
setObjectName
setParent
setProperty
setResizeMode Sets the resize mode for the multiframe, and recalculates frame sizes to match.
setShowEmptyRows Sets whether empty rows should be drawn.
setShowGrid Sets whether grid lines should be drawn in the table
setVerticalGrid Sets whether the grid’s vertical lines should be drawn in the table
setWrapBehavior Sets the wrap behavior for the table, which controls how text within cells is automatically wrapped.
showEmptyRows Returns whether empty rows are drawn in the table.
showGrid Returns whether grid lines are drawn in the table
signalsBlocked
startTimer
thread
timerEvent
totalHeight
totalSize
totalWidth
tr
type
update Forces a redraw of all child frames.
uuid Returns the multiframe identification string.
verticalGrid Returns whether the grid’s vertical lines are drawn in the table.
wrapBehavior Returns the wrap behavior for the table, which controls how text within cells is automatically wrapped.
writeObjectPropertiesToElement
writePropertiesToElement
writeXml Stores the multiframe state in a DOM element.

Attributes

AllFrames
AllProperties
BackgroundColor
BlendMode
EvaluatedValue
EvenColumns
EvenRows
ExcludeFromExports
ExtendToNextPage
FirstColumn
FirstFrame
FirstRow
FollowColumn
FrameColor
HeaderCenter
HeaderLeft
HeaderRight
HeaderRow
HeadersOnly
HideTable
ItemHeight
ItemRotation
ItemWidth
LastColumn
LastRow
LegendColumnCount
LegendTitle
MapAtlasMargin
MapLayers
MapRotation
MapScale
MapStylePreset
MapXMax
MapXMin
MapYMax
MapYMin
NoHeaders
NoProperty
NumPages
OddColumns
OddRows
Opacity
OriginalValue
PageNumber
PaperHeight
PaperOrientation
PaperWidth
PictureSource
PictureSvgBackgroundColor
PictureSvgStrokeColor
PictureSvgStrokeWidth
PositionX
PositionY
PresetPaperSize
RepeatOnEveryPage
RepeatUntilFinished
ScalebarFillColor
ScalebarFillColor2
ScalebarLineColor
ScalebarLineWidth
ShowMessage
SourceUrl
TestProperty
Transparency
TruncateText
UndoHtmlBreakDistance
UndoHtmlSource
UndoHtmlStylesheet
UndoNone
UndoTableBackgroundColor
UndoTableCellStyle
UndoTableContentFontColor
UndoTableGridColor
UndoTableGridStrokeWidth
UndoTableHeaderFontColor
UndoTableMargin
UndoTableMaximumFeatures
UseExistingFrames
WrapText
changed Emitted when the properties of a multi frame have changed, and the GUI item widget must be updated.
contentsChanged Emitted when the contents of the multi frame have changed and the frames must be redrawn.
destroyed destroyed(self, QObject = None) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
addRow(self, row: Iterable[str])

Adds a row to the table

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

Note

If row is shorter than the number of columns in the table than blank cells will be inserted at the end of the row. If row contains more strings then the number of columns in the table then these extra strings will be ignored.

Note

if adding many rows, setContents() is much faster

calculateMaxColumnWidths()
calculateMaxRowHeights()
childEvent()
connectNotify()
contentsContainsRow()
create(layout: QgsLayout) → QgsLayoutItemTextTable

Returns a new QgsLayoutItemTextTable for the specified parent layout.

customEvent()
disconnectNotify()
displayName(self) → str
drawHorizontalGridLines()
getTableContents(self, contents: object) → bool
isSignalConnected()
readObjectPropertiesFromElement()
recalculateTableSize()
receivers()
rowRange()
rowsVisible()
sender()
senderSignalIndex()
setContents(self, contents: object)

Sets the contents of the text table.

Parameters:contents – list of table rows

See also

addRow()

timerEvent()
totalHeight()
totalWidth()
type(self) → int
writeObjectPropertiesToElement()