QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
A layout table subclass that displays attributes from a vector layer. More...
#include <qgslayoutitemattributetable.h>
Public Member Functions | |
QgsLayoutItemAttributeTable (QgsLayout *layout) | |
Constructor for QgsLayoutItemAttributeTable, attached to the specified layout. | |
QgsConditionalStyle | conditionalCellStyle (int row, int column) const override |
Returns the conditional style to use for the cell at row, column. | |
QgsExpressionContext | createExpressionContext () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. | |
QString | displayName () const override |
Returns the multiframe display name. | |
bool | displayOnlyVisibleFeatures () const |
Returns true if the table is set to show only features visible on a corresponding map item. | |
QString | featureFilter () const |
Returns the current expression used to filter features for the table. | |
bool | filterFeatures () const |
Returns true if a feature filter is active on the attribute table. | |
bool | filterToAtlasFeature () const |
Returns true if the table is set to only show features which intersect the current atlas feature. | |
void | finalizeRestoreFromXml () override |
Called after all pending items have been restored from XML. | |
bool | getTableContents (QgsLayoutTableContents &contents) override |
Queries the attribute table's vector layer for attributes to show in the table. | |
QIcon | icon () const override |
Returns the item's icon. | |
QgsLayoutItemMap * | map () const |
Returns the layout map whose extents are controlling the features shown in the table. | |
int | maximumNumberOfFeatures () const |
Returns the maximum number of features to be shown by the table. | |
void | refreshDataDefinedProperty (QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::DataDefinedProperty::AllProperties) override |
Refreshes a data defined property for the multi frame by reevaluating the property's value and redrawing the item with this new value. | |
QString | relationId () const |
Returns the relation id which the table displays child features from. | |
void | resetColumns () |
Resets the attribute table's columns to match the vector layer's fields. | |
QgsExpressionContextScope * | scopeForCell (int row, int column) const override |
Creates a new QgsExpressionContextScope for the cell at row, column. | |
void | setDisplayedFields (const QStringList &fields, bool refresh=true) |
Sets the attributes to display in the table. | |
void | setDisplayOnlyVisibleFeatures (bool visibleOnly) |
Sets the attribute table to only show features which are visible in a map item. | |
void | setFeatureFilter (const QString &expression) |
Sets the expression used for filtering features in the table. | |
void | setFilterFeatures (bool filter) |
Sets whether the feature filter is active for the attribute table. | |
void | setFilterToAtlasFeature (bool filterToAtlas) |
Sets attribute table to only show features which intersect the current atlas feature. | |
void | setMap (QgsLayoutItemMap *map) |
Sets a layout map to use to limit the extent of features shown in the attribute table. | |
void | setMaximumNumberOfFeatures (int features) |
Sets the maximum number of features shown by the table. | |
void | setRelationId (const QString &id) |
Sets the relation id from which to display child features. | |
void | setSource (ContentSource source) |
Sets the source for attributes to show in table body. | |
void | setUniqueRowsOnly (bool uniqueOnly) |
Sets attribute table to only show unique rows. | |
void | setUseConditionalStyling (bool enabled) |
Sets whether the attribute table will be rendered using the conditional styling properties of the linked vector layer. | |
void | setVectorLayer (QgsVectorLayer *layer) |
Sets the vector layer from which to display feature attributes. | |
void | setWrapString (const QString &wrapString) |
Sets a string to wrap the contents of the table cells by. | |
ContentSource | source () const |
Returns the source for attributes shown in the table body. | |
QgsVectorLayer * | sourceLayer () const |
Returns the source layer for the table, considering the table source mode. | |
QgsTextFormat | textFormatForCell (int row, int column) const override |
Returns the text format to use for the cell at the specified row and column. | |
int | type () const override |
Returns unique multiframe type id. | |
bool | uniqueRowsOnly () const |
Returns true if the table is set to show only unique rows. | |
bool | useConditionalStyling () const |
Returns true if the attribute table will be rendered using the conditional styling properties of the linked vector layer. | |
QgsVectorLayer * | vectorLayer () const |
Returns the vector layer the attribute table is currently using. | |
QString | wrapString () const |
Returns the string used to wrap the contents of the table cells by. | |
Public Member Functions inherited from QgsLayoutTable | |
QgsLayoutTable (QgsLayout *layout) | |
Constructor for QgsLayoutTable, belonging to the specified layout. | |
~QgsLayoutTable () override | |
QColor | backgroundColor () const |
Returns the color used for the background of the table. | |
double | cellMargin () const |
Returns the margin distance between cell borders and their contents in mm. | |
const QgsLayoutTableStyle * | cellStyle (CellStyleGroup group) const |
Returns the cell style for a cell group. | |
QgsLayoutTableColumns & | columns () |
Returns a reference to the list of QgsLayoutTableColumns shown in the table. | |
virtual int | columnSpan (int row, int column) const |
Returns the column span for the cell a row, column. | |
Q_DECL_DEPRECATED QFont | contentFont () const |
Returns the font used to draw text in table body cells. | |
Q_DECL_DEPRECATED QColor | contentFontColor () const |
Returns the color used to draw text in table body cells. | |
QgsLayoutTableContents & | contents () |
Returns the current contents of the table. | |
QgsTextFormat | contentTextFormat () const |
Returns the format used to draw content text in the table. | |
EmptyTableMode | emptyTableBehavior () const |
Returns the behavior mode for empty tables. | |
QString | emptyTableMessage () const |
Returns the message for empty tables with no content rows. | |
QSizeF | fixedFrameSize (int frameIndex=-1) const override |
Returns the fixed size for a frame, if desired. | |
QColor | gridColor () const |
Returns the color used for grid lines in the table. | |
double | gridStrokeWidth () const |
Returns the width of grid lines in the table in mm. | |
Q_DECL_DEPRECATED QFont | headerFont () const |
Returns the font used to draw header text in the table. | |
Q_DECL_DEPRECATED QColor | headerFontColor () const |
Returns the color used to draw header text in the table. | |
HeaderHAlignment | headerHAlignment () const |
Returns the horizontal alignment for table headers. | |
virtual QMap< int, QString > | headerLabels () const |
Returns the text used in the column headers for the table. | |
HeaderMode | headerMode () const |
Returns the display mode for headers in the table. | |
QgsTextFormat | headerTextFormat () const |
Returns the format used to draw header text in the table. | |
bool | horizontalGrid () const |
Returns whether the grid's horizontal lines are drawn in the table. | |
QSizeF | minFrameSize (int frameIndex=-1) const override |
Returns the minimum size for a frames, if desired. | |
bool | readPropertiesFromElement (const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override |
Sets multiframe state from a DOM element. | |
void | render (QgsLayoutItemRenderContext &context, const QRectF &renderExtent, int frameIndex) override |
Renders a portion of the multiframe's content into a render context. | |
virtual int | rowSpan (int row, int column) const |
Returns the row span for the cell a row, column. | |
void | setBackgroundColor (const QColor &color) |
Sets the color used for background of table. | |
void | setCellMargin (double margin) |
Sets the margin distance in mm between cell borders and their contents. | |
void | setCellStyle (CellStyleGroup group, const QgsLayoutTableStyle &style) |
Sets the cell style for a cell group. | |
void | setColumns (const QgsLayoutTableColumns &columns) |
Replaces the columns in the table with a specified list of QgsLayoutTableColumns. | |
Q_DECL_DEPRECATED void | setContentFont (const QFont &font) |
Sets the font used to draw text in table body cells. | |
Q_DECL_DEPRECATED void | setContentFontColor (const QColor &color) |
Sets the color used to draw text in table body cells. | |
void | setContentTextFormat (const QgsTextFormat &format) |
Sets the format used to draw content text in the table. | |
void | setEmptyTableBehavior (EmptyTableMode mode) |
Sets the behavior mode for empty tables with no content rows. | |
void | setEmptyTableMessage (const QString &message) |
Sets the message for empty tables with no content rows. | |
void | setGridColor (const QColor &color) |
Sets the color used for grid lines in the table. | |
void | setGridStrokeWidth (double width) |
Sets the width in mm for grid lines in the table. | |
Q_DECL_DEPRECATED void | setHeaderFont (const QFont &font) |
Sets the font used to draw header text in the table. | |
Q_DECL_DEPRECATED void | setHeaderFontColor (const QColor &color) |
Sets the color used to draw header text in the table. | |
void | setHeaderHAlignment (HeaderHAlignment alignment) |
Sets the horizontal alignment for table headers. | |
void | setHeaderMode (HeaderMode mode) |
Sets the display mode for headers in the table. | |
void | setHeaderTextFormat (const QgsTextFormat &format) |
Sets the format used to draw header text in the table. | |
void | setHorizontalGrid (bool horizontalGrid) |
Sets whether the grid's horizontal lines should be drawn in the table. | |
void | setShowEmptyRows (bool showEmpty) |
Sets whether empty rows should be drawn. | |
void | setShowGrid (bool showGrid) |
Sets whether grid lines should be drawn in the table. | |
void | setSortColumns (const QgsLayoutTableSortColumns &sortColumns) |
Replaces the sorting columns in the table with a specified list of QgsLayoutTableSortColumns. | |
void | setVerticalGrid (bool verticalGrid) |
Sets whether the grid's vertical lines should be drawn in the table. | |
void | setWrapBehavior (WrapBehavior behavior) |
Sets the wrap behavior for the table, which controls how text within cells is automatically wrapped. | |
bool | showEmptyRows () const |
Returns whether empty rows are drawn in the table. | |
bool | showGrid () const |
Returns whether grid lines are drawn in the table. | |
QgsLayoutTableSortColumns & | sortColumns () |
Returns a reference to the list of QgsLayoutTableSortColumns shown in the table. | |
QSizeF | totalSize () const override |
Returns the total size of the multiframe's content, in layout units. | |
bool | verticalGrid () const |
Returns whether the grid's vertical lines are drawn in the table. | |
WrapBehavior | wrapBehavior () const |
Returns the wrap behavior for the table, which controls how text within cells is automatically wrapped. | |
bool | writePropertiesToElement (QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override |
Stores multiframe state within an XML DOM element. | |
Public Member Functions inherited from QgsLayoutMultiFrame | |
QgsLayoutMultiFrame (QgsLayout *layout) | |
Construct a new multiframe item, attached to the specified layout. | |
~QgsLayoutMultiFrame () override | |
virtual void | addFrame (QgsLayoutFrame *frame, bool recalcFrameSizes=true) |
Adds a frame to the multiframe. | |
void | beginCommand (const QString &commandText, UndoCommand command=UndoNone) |
Starts new undo command for this item. | |
void | cancelCommand () |
Cancels the current item command and discards it. | |
QgsAbstractLayoutUndoCommand * | createCommand (const QString &text, int id, QUndoCommand *parent=nullptr) override |
Creates a new layout undo command with the specified text and parent. | |
QgsExpressionContext | createExpressionContext () const override |
This method needs to be reimplemented in all classes which implement this interface and return an expression context. | |
QgsLayoutFrame * | createNewFrame (QgsLayoutFrame *currentFrame, QPointF pos, QSizeF size) |
Creates a new frame and adds it to the multi frame and layout. | |
void | deleteFrames () |
Removes and deletes all child frames. | |
void | endCommand () |
Completes the current item command and push it onto the layout's undo stack. | |
virtual double | findNearbyPageBreak (double yPos) |
Finds the optimal position to break a frame at. | |
QgsLayoutFrame * | frame (int index) const |
Returns the child frame at a specified index from the multiframe. | |
int | frameCount () const |
Returns the number of frames associated with this multiframe. | |
int | frameIndex (QgsLayoutFrame *frame) const |
Returns the index of a frame within the multiframe. | |
QList< QgsLayoutFrame * > | frames () const |
Returns a list of all child frames for this multiframe. | |
bool | readXml (const QDomElement &itemElement, const QDomDocument &document, const QgsReadWriteContext &context, bool includeFrames=false) |
Sets the item state from a DOM element. | |
void | removeFrame (int index, bool removeEmptyPages=false) |
Removes a frame by index from the multiframe. | |
ResizeMode | resizeMode () const |
Returns the resize mode for the multiframe. | |
void | setResizeMode (ResizeMode mode) |
Sets the resize mode for the multiframe, and recalculates frame sizes to match. | |
QString | uuid () const |
Returns the multiframe identification string. | |
bool | writeXml (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context, bool includeFrames=false) const |
Stores the multiframe state in a DOM element. | |
Public Member Functions inherited from QgsLayoutObject | |
QgsLayoutObject (QgsLayout *layout) | |
Constructor for QgsLayoutObject, with the specified parent layout. | |
QgsExpressionContext | createExpressionContext () const override |
Creates an expression context relating to the objects' current state. | |
QStringList | customProperties () const |
Returns list of keys stored in custom properties for the object. | |
QVariant | customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const |
Read a custom property from the object. | |
QgsPropertyCollection & | dataDefinedProperties () |
Returns a reference to the object's property collection, used for data defined overrides. | |
const QgsPropertyCollection & | dataDefinedProperties () const |
Returns a reference to the object's property collection, used for data defined overrides. | |
QgsLayout * | layout () |
Returns the layout the object is attached to. | |
const QgsLayout * | layout () const |
Returns the layout the object is attached to. | |
void | removeCustomProperty (const QString &key) |
Remove a custom property from the object. | |
void | setCustomProperty (const QString &key, const QVariant &value) |
Set a custom property for the object. | |
void | setDataDefinedProperties (const QgsPropertyCollection &collection) |
Sets the objects's property collection, used for data defined overrides. | |
Public Member Functions inherited from QgsExpressionContextGenerator | |
virtual | ~QgsExpressionContextGenerator ()=default |
Public Member Functions inherited from QgsLayoutUndoObjectInterface | |
virtual | ~QgsLayoutUndoObjectInterface ()=default |
Static Public Member Functions | |
static QgsLayoutItemAttributeTable * | create (QgsLayout *layout) |
Returns a new QgsLayoutItemAttributeTable for the specified parent layout. | |
Static Public Member Functions inherited from QgsLayoutObject | |
static bool | propertyAssociatesWithParentMultiframe (DataDefinedProperty property) |
Returns true if the specified property key is normally associated with the parent QgsLayoutMultiFrame object instead of a child QgsLayoutFrame object. | |
static const QgsPropertiesDefinition & | propertyDefinitions () |
Returns the layout object property definitions. | |
Protected Member Functions | |
bool | readPropertiesFromElement (const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override |
Sets multiframe state from a DOM element. | |
bool | writePropertiesToElement (QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override |
Stores multiframe state within an XML DOM element. | |
Protected Member Functions inherited from QgsLayoutTable | |
virtual bool | calculateMaxColumnWidths () |
Calculates the maximum width of text shown in columns. | |
virtual bool | calculateMaxRowHeights () |
Calculates the maximum height of text shown in rows. | |
bool | contentsContainsRow (const QgsLayoutTableContents &contents, const QgsLayoutTableRow &row) const |
Checks whether a table contents contains a given row. | |
void | drawHorizontalGridLines (QgsLayoutItemRenderContext &context, int firstRow, int lastRow, bool drawHeaderLines) const |
Draws the horizontal grid lines for the table. | |
void | drawVerticalGridLines (QgsLayoutItemRenderContext &context, const QMap< int, double > &maxWidthMap, int firstRow, int lastRow, bool hasHeader, bool mergeCells=false) const |
Draws the vertical grid lines for the table. | |
virtual Qt::Alignment | horizontalAlignmentForCell (int row, int column) const |
Returns the horizontal alignment to use for the cell at the specified row and column. | |
void | recalculateTableSize () |
Recalculates and updates the size of the table and all table frames. | |
QPair< int, int > | rowRange (QgsRenderContext &context, int frameIndex) const |
Calculates a range of rows which should be visible in a given frame. | |
int | rowsVisible (QgsRenderContext &context, double frameHeight, int firstRow, bool includeHeader, bool includeEmptyRows) const |
Calculates how many content rows would be visible within a frame of the specified height. | |
int | rowsVisible (QgsRenderContext &context, int frameIndex, int firstRow, bool includeEmptyRows) const |
Calculates how many content rows are visible within a given frame. | |
virtual QgsTextFormat | textFormatForHeader (int column) const |
Returns the text format to use for the header cell at the specified column. | |
double | totalHeight () |
Returns total height of table contents. | |
double | totalWidth () |
Returns total width of table contents. | |
virtual Qt::Alignment | verticalAlignmentForCell (int row, int column) const |
Returns the vertical alignment to use for the cell at the specified row and column. | |
Protected Member Functions inherited from QgsLayoutObject | |
bool | readObjectPropertiesFromElement (const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext &context) |
Sets object properties from a DOM element. | |
bool | writeObjectPropertiesToElement (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const |
Stores object properties within an XML DOM element. | |
Additional Inherited Members | |
Public Slots inherited from QgsLayoutTable | |
void | recalculateFrameSizes () override |
void | refresh () override |
virtual void | refreshAttributes () |
Refreshes the contents shown in the table by querying for new data. | |
Public Slots inherited from QgsLayoutMultiFrame | |
void | recalculateFrameRects () |
Forces a recalculation of all the associated frame's scene rectangles. | |
virtual void | recalculateFrameSizes () |
Recalculates the portion of the multiframe item which is shown in each of its component frames. | |
void | refresh () override |
Refreshes the multiframe, causing a recalculation of any property overrides. | |
void | update () |
Forces a redraw of all child frames. | |
Public Slots inherited from QgsLayoutObject | |
virtual void | refresh () |
Refreshes the object, causing a recalculation of any property overrides. | |
Signals inherited from QgsLayoutMultiFrame | |
void | contentsChanged () |
Emitted when the contents of the multi frame have changed and the frames must be redrawn. | |
Signals inherited from QgsLayoutObject | |
void | changed () |
Emitted when the object's properties change. | |
Protected Attributes inherited from QgsLayoutTable | |
QColor | mBackgroundColor = Qt::white |
Color for table background. | |
double | mCellMargin = 1.0 |
Margin between cell borders and cell text. | |
QMap< CellStyleGroup, QgsLayoutTableStyle * > | mCellStyles |
QgsLayoutTableColumns | mColumns |
Columns to show in table. | |
QgsTextFormat | mContentTextFormat |
QString | mEmptyTableMessage |
String to show in empty tables. | |
EmptyTableMode | mEmptyTableMode = HeadersOnly |
Behavior for empty tables. | |
QColor | mGridColor = Qt::black |
Color for grid lines. | |
double | mGridStrokeWidth = 0.5 |
Width of grid lines. | |
HeaderHAlignment | mHeaderHAlignment = FollowColumn |
Alignment for table headers. | |
HeaderMode | mHeaderMode = FirstFrame |
Header display mode. | |
QgsTextFormat | mHeaderTextFormat |
bool | mHorizontalGrid = true |
True if grid should be shown. | |
QMap< int, double > | mMaxColumnWidthMap |
Map of maximum width for each column. | |
QMap< int, double > | mMaxRowHeightMap |
Map of maximum height for each row. | |
bool | mShowEmptyRows = false |
True if empty rows should be shown in the table. | |
bool | mShowGrid = true |
True if grid should be shown. | |
QgsLayoutTableSortColumns | mSortColumns |
Columns to sort the table. | |
QgsLayoutTableContents | mTableContents |
Contents to show in table. | |
QSizeF | mTableSize |
bool | mVerticalGrid = true |
True if grid should be shown. | |
WrapBehavior | mWrapBehavior = TruncateText |
Protected Attributes inherited from QgsLayoutMultiFrame | |
QList< QgsLayoutFrame * > | mFrameItems |
ResizeMode | mResizeMode = UseExistingFrames |
Protected Attributes inherited from QgsLayoutObject | |
QgsObjectCustomProperties | mCustomProperties |
Custom properties for object. | |
QgsPropertyCollection | mDataDefinedProperties |
QPointer< QgsLayout > | mLayout |
A layout table subclass that displays attributes from a vector layer.
Definition at line 33 of file qgslayoutitemattributetable.h.
Specifies the content source for the attribute table.
Definition at line 42 of file qgslayoutitemattributetable.h.
QgsLayoutItemAttributeTable::QgsLayoutItemAttributeTable | ( | QgsLayout * | layout | ) |
Constructor for QgsLayoutItemAttributeTable, attached to the specified layout.
Ownership is transferred to the layout.
Definition at line 46 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
Returns the conditional style to use for the cell at row, column.
Reimplemented from QgsLayoutTable.
Definition at line 664 of file qgslayoutitemattributetable.cpp.
|
static |
Returns a new QgsLayoutItemAttributeTable for the specified parent layout.
Definition at line 69 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
This method needs to be reimplemented in all classes which implement this interface and return an expression context.
Implements QgsExpressionContextGenerator.
Definition at line 721 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
Returns the multiframe display name.
Reimplemented from QgsLayoutMultiFrame.
Definition at line 74 of file qgslayoutitemattributetable.cpp.
|
inline |
Returns true
if the table is set to show only features visible on a corresponding map item.
Definition at line 193 of file qgslayoutitemattributetable.h.
|
inline |
Returns the current expression used to filter features for the table.
The filter is only active if filterFeatures() is true
.
Definition at line 235 of file qgslayoutitemattributetable.h.
|
inline |
Returns true
if a feature filter is active on the attribute table.
Definition at line 217 of file qgslayoutitemattributetable.h.
|
inline |
Returns true
if the table is set to only show features which intersect the current atlas feature.
Definition at line 209 of file qgslayoutitemattributetable.h.
|
overridevirtual |
Called after all pending items have been restored from XML.
Multiframes can use this method to run steps which must take place after all items have been restored to the layout, such as connecting to signals emitted by other items, which may not have existed in the layout at the time readXml() was called. E.g. a scalebar can use this to connect to its linked map item after restoration from XML.
Reimplemented from QgsLayoutMultiFrame.
Definition at line 733 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
Queries the attribute table's vector layer for attributes to show in the table.
contents | table content |
true
if attributes were successfully fetched Implements QgsLayoutTable.
Definition at line 392 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
Returns the item's icon.
Reimplemented from QgsLayoutMultiFrame.
Definition at line 64 of file qgslayoutitemattributetable.cpp.
|
inline |
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
.
Definition at line 143 of file qgslayoutitemattributetable.h.
|
inline |
Returns the maximum number of features to be shown by the table.
Definition at line 157 of file qgslayoutitemattributetable.h.
|
overrideprotectedvirtual |
Sets multiframe state from a DOM element.
element | is the DOM element for the multiframe |
document | DOM document |
context | read write context |
Note that item subclasses should not rely on all other items being present in the layout at the time this method is called. Instead, any connections and links to other items must be made in the finalizeRestoreFromXml() method. E.g. when restoring a scalebar, the connection to the linked map's signals should be implemented in finalizeRestoreFromXml(), not readPropertiesFromElement().
Reimplemented from QgsLayoutMultiFrame.
Definition at line 918 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
Refreshes a data defined property for the multi frame by reevaluating the property's value and redrawing the item with this new value.
If property is set to QgsLayoutObject::AllProperties then all data defined properties for the item will be refreshed.
Reimplemented from QgsLayoutMultiFrame.
Definition at line 748 of file qgslayoutitemattributetable.cpp.
|
inline |
Returns the relation id which the table displays child features from.
Definition at line 118 of file qgslayoutitemattributetable.h.
void QgsLayoutItemAttributeTable::resetColumns | ( | ) |
Resets the attribute table's columns to match the vector layer's fields.
Definition at line 171 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
Creates a new QgsExpressionContextScope for the cell at row, column.
Reimplemented from QgsLayoutTable.
Definition at line 713 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setDisplayedFields | ( | const QStringList & | fields, |
bool | refresh = true |
||
) |
Sets the attributes to display in the table.
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. |
Definition at line 320 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setDisplayOnlyVisibleFeatures | ( | bool | visibleOnly | ) |
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.
Definition at line 272 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setFeatureFilter | ( | const QString & | expression | ) |
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.
Definition at line 308 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setFilterFeatures | ( | bool | filter | ) |
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.
Definition at line 296 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setFilterToAtlasFeature | ( | bool | filterToAtlas | ) |
Sets attribute table to only show features which intersect the current atlas feature.
Definition at line 284 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setMap | ( | QgsLayoutItemMap * | map | ) |
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.
Definition at line 228 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setMaximumNumberOfFeatures | ( | int | features | ) |
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.
Definition at line 248 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setRelationId | ( | const QString & | id | ) |
Sets the relation id from which to display child features.
Definition at line 109 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setSource | ( | const QgsLayoutItemAttributeTable::ContentSource | source | ) |
Sets the source for attributes to show in table body.
Definition at line 974 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setUniqueRowsOnly | ( | bool | uniqueOnly | ) |
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.
Definition at line 260 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setUseConditionalStyling | ( | bool | enabled | ) |
Sets whether the attribute table will be rendered using the conditional styling properties of the linked vector layer.
Definition at line 216 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setVectorLayer | ( | QgsVectorLayer * | layer | ) |
Sets the vector layer from which to display feature attributes.
This is only considered if the table source() is LayerAttributes.
Definition at line 79 of file qgslayoutitemattributetable.cpp.
void QgsLayoutItemAttributeTable::setWrapString | ( | const QString & | wrapString | ) |
Sets a string to wrap the contents of the table cells by.
Occurrences of this string will be replaced by a line break.
wrapString | string to replace with line break |
Definition at line 875 of file qgslayoutitemattributetable.cpp.
|
inline |
Returns the source for attributes shown in the table body.
Definition at line 75 of file qgslayoutitemattributetable.h.
QgsVectorLayer * QgsLayoutItemAttributeTable::sourceLayer | ( | ) | const |
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.
Definition at line 840 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
Returns the text format to use for the cell at the specified row and column.
Reimplemented from QgsLayoutTable.
Definition at line 672 of file qgslayoutitemattributetable.cpp.
|
overridevirtual |
Returns unique multiframe type id.
Implements QgsLayoutMultiFrame.
Definition at line 59 of file qgslayoutitemattributetable.cpp.
|
inline |
Returns true
if the table is set to show only unique rows.
Definition at line 174 of file qgslayoutitemattributetable.h.
bool QgsLayoutItemAttributeTable::useConditionalStyling | ( | ) | const |
Returns true
if the attribute table will be rendered using the conditional styling properties of the linked vector layer.
Definition at line 211 of file qgslayoutitemattributetable.cpp.
|
inline |
Returns the vector layer the attribute table is currently using.
This is only considered if the table source() is LayerAttributes.
Definition at line 102 of file qgslayoutitemattributetable.h.
|
inline |
Returns the string used to wrap the contents of the table cells by.
Occurrences of this string will be replaced by a line break.
Definition at line 271 of file qgslayoutitemattributetable.h.
|
overrideprotectedvirtual |
Stores multiframe state within an XML DOM element.
element | is the DOM element to store the multiframe's properties in |
document | DOM document |
context | read write context |
Reimplemented from QgsLayoutMultiFrame.
Definition at line 887 of file qgslayoutitemattributetable.cpp.