Class: QgsLayoutItemAttributeTable¶
-
class
qgis.core.
QgsLayoutItemAttributeTable
(layout: QgsLayout)¶ Bases:
qgis._core.QgsLayoutTable
Constructor for QgsLayoutItemAttributeTable, attached to the specified
layout
.Ownership is transferred to the layout.
A layout table subclass that displays attributes from a vector layer.
New in version 3.0: Enums
Methods
Returns a new QgsLayoutItemAttributeTable for the specified parent
layout
.Returns true if the table is set to show only features visible on a corresponding map item.
Returns the current expression used to filter features for the table.
Returns true if a feature filter is active on the attribute table.
Returns true if the table is set to only show features which intersect the current atlas feature.
Returns the layout map whose extents are controlling the features shown in the table.
Returns the maximum number of features to be shown by the table.
Returns the relation id which the table displays child features from.
Resets the attribute table’s columns to match the vector layer’s fields.
Sets the attribute table to only show features which are visible in a map item.
Sets the attributes to display in the table.
Sets the
expression
used for filtering features in the table.Sets whether the feature filter is active for the attribute table.
Sets attribute table to only show features which intersect the current atlas feature.
Sets a layout
map
to use to limit the extent of features shown in the attribute table.Sets the maximum number of
features
shown by the table.Sets the relation
id
from which to display child featuresSets the
source
for attributes to show in table body.Sets attribute table to only show unique rows.
Sets the vector
layer
from which to display feature attributes.Sets a string to wrap the contents of the table cells by.
Returns the source for attributes shown in the table body.
Returns the source layer for the table, considering the table source mode.
Returns true if the table is set to show only unique rows.
Returns the vector layer the attribute table is currently using.
Returns the string used to wrap the contents of the table cells by.
Signals
Attributes
-
AtlasFeature
= 1¶
-
class
ContentSource
¶ Bases:
int
-
LayerAttributes
= 0¶
-
RelationChildren
= 2¶
-
calculateMaxColumnWidths
()¶
-
calculateMaxRowHeights
()¶
-
childEvent
()¶
-
connectNotify
()¶
-
contentsContainsRow
()¶
-
create
(layout: QgsLayout) → QgsLayoutItemAttributeTable¶ Returns a new QgsLayoutItemAttributeTable for the specified parent
layout
.
-
createExpressionContext
(self) → QgsExpressionContext¶
-
customEvent
()¶
-
disconnectNotify
()¶
-
displayName
(self) → str¶
-
displayOnlyVisibleFeatures
(self) → bool¶ Returns true if the table is set to show only features visible on a corresponding map item.
See also
See also
-
drawHorizontalGridLines
()¶
-
featureFilter
(self) → str¶ Returns the current expression used to filter features for the table. The filter is only active if filterFeatures() is true.
See also
See also
-
filterFeatures
(self) → bool¶ Returns true if a feature filter is active on the attribute table.
See also
See also
-
filterToAtlasFeature
(self) → bool¶ Returns true if the table is set to only show features which intersect the current atlas feature.
See also
-
finalizeRestoreFromXml
(self)¶
-
icon
(self) → QIcon¶
-
isSignalConnected
()¶
-
map
(self) → QgsLayoutItemMap¶ Returns the layout map whose extents are controlling the features shown in the table. The extents of the map are only used if displayOnlyVisibleFeatures() is true.
See also
See also
-
maximumNumberOfFeatures
(self) → int¶ Returns the maximum number of features to be shown by the table.
See also
-
readObjectPropertiesFromElement
()¶
-
readPropertiesFromElement
(self, itemElem: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool¶
-
recalculateTableSize
()¶
-
receivers
()¶
-
refreshDataDefinedProperty
(self, property: QgsLayoutObject.DataDefinedProperty = QgsLayoutObject.AllProperties)¶
-
relationId
(self) → str¶ Returns the relation id which the table displays child features from.
See also
See also
Note
Only used if table source() is set to RelationChildren.
-
resetColumns
(self)¶ Resets the attribute table’s columns to match the vector layer’s fields.
See also
-
rowRange
()¶
-
rowsVisible
()¶
-
sender
()¶
-
senderSignalIndex
()¶
-
setDisplayOnlyVisibleFeatures
(self, visibleOnly: bool)¶ Sets the attribute table to only show features which are visible in a map item. Changing this setting forces the table to refetch features from its vector layer, and may result in the table changing size to accommodate the new displayed feature attributes.
See also
See also
-
setDisplayedFields
(self, fields: Iterable[str], refresh: bool = True)¶ Sets the attributes to display in the table.
- Parameters
fields – list of fields names from the vector layer to show. Set to an empty list to show all feature attributes.
refresh – set to true to force the table to refetch features from its vector layer and immediately update the display of the table. This may result in the table changing size to accommodate the new displayed feature attributes.
-
setFeatureFilter
(self, expression: str)¶ Sets the
expression
used for filtering features in the table. The filter is only active if filterFeatures() is set to true. Changing this setting forces the table to refetch features from its vector layer, and may result in the table changing size to accommodate the new displayed feature attributes.See also
See also
-
setFilterFeatures
(self, filter: bool)¶ Sets whether the feature filter is active for the attribute table. Changing this setting forces the table to refetch features from its vector layer, and may result in the table changing size to accommodate the new displayed feature attributes.
See also
See also
-
setFilterToAtlasFeature
(self, filterToAtlas: bool)¶ Sets attribute table to only show features which intersect the current atlas feature.
See also
-
setMap
(self, map: QgsLayoutItemMap)¶ Sets a layout
map
to use to limit the extent of features shown in the attribute table. This setting only has an effect if setDisplayOnlyVisibleFeatures is set to true. Changing the map forces the table to refetch features from its vector layer, and may result in the table changing size to accommodate the new displayed feature attributes.See also
See also
-
setMaximumNumberOfFeatures
(self, features: int)¶ Sets the maximum number of
features
shown by the table. Changing this setting may result in the attribute table changing its size to accommodate the new number of rows, and requires the table to refetch features from its vector layer.See also
-
setRelationId
(self, id: str)¶ Sets the relation
id
from which to display child featuresSee also
See also
Note
Only used if table source() is set to RelationChildren.
-
setSource
(self, source: QgsLayoutItemAttributeTable.ContentSource)¶ Sets the
source
for attributes to show in table body.See also
-
setUniqueRowsOnly
(self, uniqueOnly: bool)¶ Sets attribute table to only show unique rows.
Set
uniqueOnly
to true to show only unique rows. Duplicate rows will be stripped from the table.See also
-
setVectorLayer
(self, layer: QgsVectorLayer)¶ Sets the vector
layer
from which to display feature attributes.This is only considered if the table source() is LayerAttributes.
See also
-
setWrapString
(self, wrapString: str)¶ Sets a string to wrap the contents of the table cells by. Occurrences of this string will be replaced by a line break.
- Parameters
wrapString – string to replace with line break
See also
-
source
(self) → QgsLayoutItemAttributeTable.ContentSource¶ Returns the source for attributes shown in the table body.
See also
-
sourceLayer
(self) → QgsVectorLayer¶ Returns the source layer for the table, considering the table source mode. For example, if the table is set to atlas feature mode, then the source layer will be the atlas coverage layer. If the table is set to layer attributes mode, then the source layer will be the user specified vector layer.
-
timerEvent
()¶
-
totalHeight
()¶
-
totalWidth
()¶
-
type
(self) → int¶
-
uniqueRowsOnly
(self) → bool¶ Returns true if the table is set to show only unique rows.
See also
-
vectorLayer
(self) → QgsVectorLayer¶ Returns the vector layer the attribute table is currently using.
This is only considered if the table source() is LayerAttributes.
See also
See also
-
wrapString
(self) → str¶ Returns the string used to wrap the contents of the table cells by. Occurrences of this string will be replaced by a line break.
See also
-
writeObjectPropertiesToElement
()¶
-
writePropertiesToElement
(self, elem: QDomElement, doc: QDomDocument, context: QgsReadWriteContext) → bool¶
-