QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
73 return tr(
"<Attribute table frame>" );
78 if ( layer == mVectorLayer.
get() )
116 QgsRelation relation =
mLayout->project()->relationManager()->relation( mRelationId );
138 void QgsLayoutItemAttributeTable::atlasLayerChanged(
QgsVectorLayer *layer )
147 if ( mCurrentAtlasLayer )
153 const bool mustRebuildColumns =
static_cast< bool >( mCurrentAtlasLayer ) ||
mColumns.empty();
154 mCurrentAtlasLayer = layer;
156 if ( mustRebuildColumns )
184 for (
const auto &
field : sourceFields )
186 QString currentAlias =
source->attributeDisplayName( idx );
195 void QgsLayoutItemAttributeTable::disconnectCurrentMap()
204 disconnect( mMap, &QObject::destroyed,
this, &QgsLayoutItemAttributeTable::disconnectCurrentMap );
210 return mUseConditionalStyling;
232 disconnectCurrentMap();
240 connect( mMap, &QObject::destroyed,
this, &QgsLayoutItemAttributeTable::disconnectCurrentMap );
248 if ( features == mMaximumNumberOfFeatures )
253 mMaximumNumberOfFeatures = features;
260 if ( uniqueOnly == mShowUniqueRowsOnly )
265 mShowUniqueRowsOnly = uniqueOnly;
272 if ( visibleOnly == mShowOnlyVisibleFeatures )
277 mShowOnlyVisibleFeatures = visibleOnly;
284 if ( filterToAtlas == mFilterToAtlasIntersection )
289 mFilterToAtlasIntersection = filterToAtlas;
296 if ( filter == mFilterFeatures )
301 mFilterFeatures = filter;
308 if ( expression == mFeatureFilter )
313 mFeatureFilter = expression;
331 if ( !fields.isEmpty() )
333 for (
const QString &
field : fields )
340 QString currentAlias =
source->attributeDisplayName( attrIdx );
353 QString currentAlias =
source->attributeDisplayName( idx );
368 void QgsLayoutItemAttributeTable::restoreFieldAliasMap(
const QMap<int, QString> &map )
376 for (
int i = 0; i <
mColumns.count(); i++ )
378 int attrIdx =
source->fields().lookupField(
mColumns[i].attribute() );
379 if (
map.contains( attrIdx ) )
385 mColumns[i].setHeading(
source->attributeDisplayName( attrIdx ) );
411 std::unique_ptr<QgsExpression> filterExpression;
412 bool activeFilter =
false;
413 if ( mFilterFeatures && !mFeatureFilter.isEmpty() )
415 filterExpression = std::make_unique< QgsExpression >( mFeatureFilter );
416 if ( !filterExpression->hasParserError() )
423 #ifdef HAVE_SERVER_PYTHON_PLUGINS
424 if (
mLayout->renderContext().featureFilterProvider() )
426 mLayout->renderContext().featureFilterProvider()->filterFeatures( layer, req );
432 std::unique_ptr< QgsGeometryEngine > visibleMapEngine;
433 if ( mMap && mShowOnlyVisibleFeatures )
443 selectionRect = extentTransform.
transformBoundingBox( selectionRect, Qgis::TransformDirection::Reverse );
444 visibleRegion.
transform( coordTransform, Qgis::TransformDirection::Reverse );
452 visibleMapEngine->prepareGeometry();
456 std::unique_ptr< QgsGeometryEngine > atlasGeometryEngine;
457 if ( mFilterToAtlasIntersection )
459 atlasGeometry =
mLayout->reportContext().currentGeometry( layer->
crs() );
460 if ( !atlasGeometry.
isNull() )
462 if ( selectionRect.
isNull() )
472 atlasGeometryEngine->prepareGeometry();
478 QgsRelation relation =
mLayout->project()->relationManager()->relation( mRelationId );
483 if ( !selectionRect.
isEmpty() )
497 req.
addOrderBy( column.attribute(), column.sortOrder() == Qt::AscendingOrder );
504 mConditionalStyles.clear();
507 QVector< QVector< Cell > > tempContents;
510 while ( fit.
nextFeature( f ) && counter < mMaximumNumberOfFeatures )
514 if ( activeFilter && filterExpression )
516 QVariant result = filterExpression->evaluate( &context );
518 if ( !result.toBool() )
525 if ( visibleMapEngine )
535 if ( mFilterToAtlasIntersection )
548 if ( mUseConditionalStyling )
559 QVector< Cell > currentRow;
560 #ifdef HAVE_SERVER_PYTHON_PLUGINS
563 currentRow.reserve(
mColumns.count() );
565 rowContents.reserve(
mColumns.count() );
575 if ( mUseConditionalStyling )
579 styles.insert( 0, rowStyle );
590 auto it = mLayerCache.constFind( column.attribute() );
591 if ( it != mLayerCache.constEnd() )
598 mLayerCache.insert( column.attribute(), cache );
604 QVariant v = val.isNull() ? QString() : replaceWrapChar( val );
605 currentRow << Cell( v, style, f );
611 std::unique_ptr< QgsExpression > expression = std::make_unique< QgsExpression >( column.attribute() );
613 expression->prepare( &context );
614 QVariant value = expression->evaluate( &context );
616 currentRow << Cell( value, rowStyle, f );
617 rowContents << value;
621 if ( mShowUniqueRowsOnly )
627 tempContents << currentRow;
628 existingContents << rowContents;
633 contents.reserve( tempContents.size() );
634 mConditionalStyles.reserve( tempContents.size() );
635 mFeatures.reserve( tempContents.size() );
636 for (
auto it = tempContents.constBegin(); it != tempContents.constEnd(); ++it )
639 QList< QgsConditionalStyle > rowStyles;
640 row.reserve( it->size() );
641 rowStyles.reserve( it->size() );
643 for (
auto cellIt = it->constBegin(); cellIt != it->constEnd(); ++cellIt )
645 row << cellIt->content;
646 rowStyles << cellIt->style;
647 if ( cellIt == it->constBegin() )
648 mFeatures << cellIt->feature;
651 mConditionalStyles << rowStyles;
660 if ( row >= mConditionalStyles.size() )
663 return mConditionalStyles.at( row ).at( column );
674 const QFont styleFont = style.
font();
675 if ( styleFont != QFont() )
677 QFont newFont = format.
font();
679 newFont.setFamily( styleFont.family() );
685 if ( !styleName.isEmpty() )
686 newFont.setStyleName( styleName );
688 newFont.setStrikeOut( styleFont.strikeOut() );
689 newFont.setUnderline( styleFont.underline() );
691 if ( styleName.isEmpty() )
696 if ( styleFont.bold() )
698 if ( styleFont.italic() )
710 scope->setFeature( mFeatures.value( row ) );
711 scope->setFields( scope->feature().fields() );
712 return scope.release();
730 if ( !mMap && !mMapUuid.isEmpty() &&
mLayout )
732 mMap = qobject_cast< QgsLayoutItemMap *>(
mLayout->itemByUuid( mMapUuid,
true ) );
749 mDataDefinedVectorLayer =
nullptr;
751 QString currentLayerIdentifier;
753 currentLayerIdentifier = currentLayer->id();
758 mDataDefinedVectorLayer = ddLayer;
764 QVariant QgsLayoutItemAttributeTable::replaceWrapChar(
const QVariant &variant )
const
767 if ( mWrapString.isEmpty() || !variant.toString().contains( mWrapString ) )
770 QString replaced = variant.toString();
771 replaced.replace( mWrapString, QLatin1String(
"\n" ) );
775 #ifdef HAVE_SERVER_PYTHON_PLUGINS
782 if (
mLayout->renderContext().featureFilterProvider() )
789 return allowedColumns;
792 QHash<const QString, QSet<QString>> columnAttributesMap;
793 QSet<QString> allowedAttributes;
795 for (
const auto &
c : std::as_const( allowedColumns ) )
797 if ( !
c.attribute().isEmpty() && ! columnAttributesMap.contains(
c.attribute() ) )
799 columnAttributesMap[
c.attribute() ] = QSet<QString>();
802 for (
const auto &cref : constRefs )
804 columnAttributesMap[
c.attribute() ].insert( cref->name() );
805 allowedAttributes.insert( cref->name() );
811 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
812 const QSet<QString> filteredAttributesSet( filteredAttributes.constBegin(), filteredAttributes.constEnd() );
814 const QSet<QString> filteredAttributesSet { filteredAttributes.toSet() };
816 if ( filteredAttributesSet != allowedAttributes )
818 const auto forbidden { allowedAttributes.subtract( filteredAttributesSet ) };
819 allowedColumns.erase( std::remove_if( allowedColumns.begin(), allowedColumns.end(), [ &columnAttributesMap, &forbidden ](
QgsLayoutTableColumn &
c ) ->
bool
821 for ( const auto &f : std::as_const( forbidden ) )
823 if ( columnAttributesMap[ c.attribute() ].contains( f ) )
829 } ), allowedColumns.end() );
834 return allowedColumns;
843 return mLayout->reportContext().layer();
846 if ( mDataDefinedVectorLayer )
847 return mDataDefinedVectorLayer;
849 return mVectorLayer.
get();
853 QgsRelation relation =
mLayout->project()->relationManager()->relation( mRelationId );
860 void QgsLayoutItemAttributeTable::removeLayer(
const QString &layerId )
864 if ( layerId == mVectorLayer->
id() )
890 tableElem.setAttribute( QStringLiteral(
"source" ), QString::number(
static_cast< int >( mSource ) ) );
891 tableElem.setAttribute( QStringLiteral(
"relationId" ), mRelationId );
892 tableElem.setAttribute( QStringLiteral(
"showUniqueRowsOnly" ), mShowUniqueRowsOnly );
893 tableElem.setAttribute( QStringLiteral(
"showOnlyVisibleFeatures" ), mShowOnlyVisibleFeatures );
894 tableElem.setAttribute( QStringLiteral(
"filterToAtlasIntersection" ), mFilterToAtlasIntersection );
895 tableElem.setAttribute( QStringLiteral(
"maxFeatures" ), mMaximumNumberOfFeatures );
896 tableElem.setAttribute( QStringLiteral(
"filterFeatures" ), mFilterFeatures ? QStringLiteral(
"true" ) : QStringLiteral(
"false" ) );
897 tableElem.setAttribute( QStringLiteral(
"featureFilter" ), mFeatureFilter );
898 tableElem.setAttribute( QStringLiteral(
"wrapString" ), mWrapString );
899 tableElem.setAttribute( QStringLiteral(
"useConditionalStyling" ), mUseConditionalStyling );
903 tableElem.setAttribute( QStringLiteral(
"mapUuid" ), mMap->
uuid() );
908 tableElem.setAttribute( QStringLiteral(
"vectorLayer" ), mVectorLayer.
layerId );
909 tableElem.setAttribute( QStringLiteral(
"vectorLayerName" ), mVectorLayer.
name );
910 tableElem.setAttribute( QStringLiteral(
"vectorLayerSource" ), mVectorLayer.
source );
911 tableElem.setAttribute( QStringLiteral(
"vectorLayerProvider" ), mVectorLayer.
provider );
928 mRelationId = itemElem.attribute( QStringLiteral(
"relationId" ), QString() );
932 mCurrentAtlasLayer =
mLayout->reportContext().layer();
935 mShowUniqueRowsOnly = itemElem.attribute( QStringLiteral(
"showUniqueRowsOnly" ), QStringLiteral(
"0" ) ).toInt();
936 mShowOnlyVisibleFeatures = itemElem.attribute( QStringLiteral(
"showOnlyVisibleFeatures" ), QStringLiteral(
"1" ) ).toInt();
937 mFilterToAtlasIntersection = itemElem.attribute( QStringLiteral(
"filterToAtlasIntersection" ), QStringLiteral(
"0" ) ).toInt();
938 mFilterFeatures = itemElem.attribute( QStringLiteral(
"filterFeatures" ), QStringLiteral(
"false" ) ) == QLatin1String(
"true" );
939 mFeatureFilter = itemElem.attribute( QStringLiteral(
"featureFilter" ), QString() );
940 mMaximumNumberOfFeatures = itemElem.attribute( QStringLiteral(
"maxFeatures" ), QStringLiteral(
"5" ) ).toInt();
941 mWrapString = itemElem.attribute( QStringLiteral(
"wrapString" ) );
942 mUseConditionalStyling = itemElem.attribute( QStringLiteral(
"useConditionalStyling" ), QStringLiteral(
"0" ) ).toInt();
945 mMapUuid = itemElem.attribute( QStringLiteral(
"mapUuid" ) );
955 QString layerId = itemElem.attribute( QStringLiteral(
"vectorLayer" ) );
956 QString layerName = itemElem.attribute( QStringLiteral(
"vectorLayerName" ) );
957 QString layerSource = itemElem.attribute( QStringLiteral(
"vectorLayerSource" ) );
958 QString layerProvider = itemElem.attribute( QStringLiteral(
"vectorLayerProvider" ) );
959 mVectorLayer =
QgsVectorLayerRef( layerId, layerName, layerSource, layerProvider );
983 if ( newLayer != prevLayer )
995 mCurrentAtlasLayer = newLayer;
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
void layerWillBeRemoved(const QString &layerId)
Emitted when a layer is about to be removed from the registry.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsCoordinateReferenceSystem crs
const QgsLayout * layout() const
Returns the layout the object is attached to.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
void setDisplayedFields(const QStringList &fields, bool refresh=true)
Sets the attributes to display in the table.
bool isValid() const
isValid Check if this rule is valid.
void setFilterToAtlasFeature(bool filterToAtlas)
Sets attribute table to only show features which intersect the current atlas feature.
QVector< QgsLayoutTableColumn > QgsLayoutTableColumns
List of column definitions for a QgsLayoutTable.
void setFont(const QFont &font)
Sets the font used for rendering text.
QgsFeatureRequest & addOrderBy(const QString &expression, bool ascending=true)
Adds a new OrderByClause, appending it as the least important one.
void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::AllProperties) override
Refreshes a data defined property for the multi frame by reevaluating the property's value and redraw...
QVector< QgsLayoutTableRow > QgsLayoutTableContents
List of QgsLayoutTableRows, representing rows and column cell contents for a QgsLayoutTable.
TYPE * resolveWeakly(const QgsProject *project, MatchType matchType=MatchType::All)
Resolves the map layer by attempting to find a matching layer in a project using a weak match.
QgsVectorLayer * sourceLayer() const
Returns the source layer for the table, considering the table source mode.
The class is used as a container of context for various read/write operations on other objects.
@ ExactIntersect
Use exact geometry intersection (slower) instead of bounding boxes.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
Qgis::GeometryOperationResult transform(const QgsCoordinateTransform &ct, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
virtual void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::AllProperties)
Refreshes a data defined property for the multi frame by reevaluating the property's value and redraw...
QgsLayoutRenderContext & renderContext()
Returns a reference to the layout's render context, which stores information relating to the current ...
void extentChanged()
Emitted when the map's extent changes.
An expression node which takes it value from a feature's field.
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
Container of fields for a vector layer.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
QIcon icon() const override
Returns the item's icon.
QString relationId() const
Returns the relation id which the table displays child features from.
QgsPropertyCollection mDataDefinedProperties
void setFilterFeatures(bool filter)
Sets whether the feature filter is active for the attribute table.
void setFields(const QgsFields &fields)
Convenience function for setting a fields for the context.
bool writePropertiesToElement(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override
Stores multiframe state within an XML DOM element.
@ AttributeTableSourceLayer
Attribute table source layer.
The QgsConditionalLayerStyles class holds conditional style information for a layer....
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
void changed()
Emitted when the object's properties change.
void setFeatureFilter(const QString &expression)
Sets the expression used for filtering features in the table.
Conditional styling for a rule.
A rectangle specified with double values.
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 lin...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
static QgsConditionalStyle compressStyles(const QList< QgsConditionalStyle > &styles)
Compress a list of styles into a single style.
QgsFeatureRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate filter expressions.
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Sets the feature ID that should be fetched.
QgsLayoutItemAttributeTable(QgsLayout *layout)
Constructor for QgsLayoutItemAttributeTable, attached to the specified layout.
QgsVectorLayer referencingLayer
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
QgsLayoutTableSortColumns mSortColumns
Columns to sort the table.
static QString resolveFontStyleName(const QFont &font)
Attempts to resolve the style name corresponding to the specified font object.
QString layerId
Original layer ID.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
bool readPropertiesFromElement(const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override
Sets multiframe state from a DOM element.
Container for all settings relating to text rendering.
virtual QStringList layerAttributes(const QgsVectorLayer *layer, const QStringList &attributes) const =0
Returns the list of visible attribute names from a list of attributes names for the given layer.
This class wraps a request for features to a vector layer (or directly its vector data provider).
@ AllProperties
All properties for item.
bool useConditionalStyling() const
Returns true if the attribute table will be rendered using the conditional styling properties of the ...
Custom exception class for Coordinate Reference System related exceptions.
QString displayName() const override
Returns the multiframe display name.
QgsLayoutTableContents & contents()
Returns the current contents of the table.
void setLayer(TYPE *l)
Sets the reference to point to a specified layer.
QString provider
Weak reference to layer provider.
virtual QgsExpressionContextScope * scopeForCell(int row, int column) const
Creates a new QgsExpressionContextScope for the cell at row, column.
@ RelationChildren
Table shows attributes from related child features.
QgsFeatureFilterProvider * featureFilterProvider() const
Returns the possibly NULL feature filter provider.
@ LayerAttributes
Table shows attributes from features in a vector layer.
QString name
Weak reference to layer name.
int type() const override
Returns unique multiframe type id.
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
void finalizeRestoreFromXml() override
Called after all pending items have been restored from XML.
void setForcedBold(bool forced)
Sets whether the format is set to force a bold style.
ContentSource
Specifies the content source for the attribute table.
A layout table subclass that displays attributes from a vector layer.
void setAttribute(const QString &attribute)
Sets the attribute name or expression used for the column's values.
void layerModified()
Emitted when modifications has been done on layer.
A class to display a table in the print layout, and allow the table to span over multiple frames.
QString wrapString() const
Returns the string used to wrap the contents of the table cells by.
virtual void refreshAttributes()
Refreshes the contents shown in the table by querying for new data.
static QList< QgsConditionalStyle > matchingConditionalStyles(const QList< QgsConditionalStyle > &styles, const QVariant &value, QgsExpressionContext &context)
Find and return the matching styles for the value and feature.
const QgsAbstractGeometry * constGet() const SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used for rendering the map.
Single scope for storing variables and functions for use within a QgsExpressionContext....
QString valueAsString(int key, const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a string.
QgsConditionalStyle conditionalCellStyle(int row, int column) const override
Returns the conditional style to use for the cell at row, column.
static QgsFieldFormatterRegistry * fieldFormatterRegistry()
Gets the registry of available field formatters.
QFont font() const
The font for the style.
void recalculateTableSize()
Recalculates and updates the size of the table and all table frames.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setHeading(const QString &heading)
Sets the heading for a column, which is the value displayed in the column's header cell.
Layout graphical items for displaying a map.
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProject *project)
Resolves a string into a map layer from a given project.
QgsConditionalStyles rowStyles() const
Returns a list of row styles associated with the layer.
static QgsLayoutItemAttributeTable * create(QgsLayout *layout)
Returns a new QgsLayoutItemAttributeTable for the specified parent layout.
void setMaximumNumberOfFeatures(int features)
Sets the maximum number of features shown by the table.
static QgsGeometryEngine * createGeometryEngine(const QgsAbstractGeometry *geometry)
Creates and returns a new geometry engine representing the specified geometry.
virtual QString uuid() const
Returns the item identification string.
QgsFeatureRequest getRelatedFeaturesRequest(const QgsFeature &feature) const
Creates a request to return all the features on the referencing (child) layer which have a foreign ke...
void setMap(QgsLayoutItemMap *map)
Sets a layout map to use to limit the extent of features shown in the attribute table.
void setWrapString(const QString &wrapString)
Sets a string to wrap the contents of the table cells by.
QPointer< QgsLayout > mLayout
bool nextFeature(QgsFeature &f)
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
A geometry is the spatial representation of a feature.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
QString source
Weak reference to layer public source.
Represents a vector layer which manages a vector based data sets.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void mapRotationChanged(double newRotation)
Emitted when the map's rotation changes.
bool getTableContents(QgsLayoutTableContents &contents) override
Queries the attribute table's vector layer for attributes to show in the table.
@ AtlasFeature
Table shows attributes from the current atlas feature.
void setForcedItalic(bool forced)
Sets whether the format is set to force an italic style.
QgsConditionalLayerStyles * conditionalStyles() const
Returns the conditional styles that are set for this layer.
bool contentsContainsRow(const QgsLayoutTableContents &contents, const QgsLayoutTableRow &row) const
Checks whether a table contents contains a given row.
void setRelationId(const QString &id)
Sets the relation id from which to display child features.
QFont font() const
Returns the font used for rendering text.
_LayerRef< QgsVectorLayer > QgsVectorLayerRef
void setVectorLayer(QgsVectorLayer *layer)
Sets the vector layer from which to display feature attributes.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
QList< QgsConditionalStyle > fieldStyles(const QString &fieldName) const
Returns the conditional styles set for the field with matching fieldName.
static QgsGeometry fromQPolygonF(const QPolygonF &polygon)
Construct geometry from a QPolygonF.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
QVector< QVariant > QgsLayoutTableRow
List of QVariants, representing a the contents of a single row in a QgsLayoutTable.
QgsLayoutTableColumns mColumns
Columns to show in table.
Stores properties of a column for a QgsLayoutTable.
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
Single variable definition for use within a QgsExpressionContextScope.
bool readPropertiesFromElement(const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override
Sets multiframe state from a DOM element.
QgsEditorWidgetSetup editorWidgetSetup() const
Gets the editor widget setup for the field.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
Class for parsing and evaluation of expressions (formerly called "search strings")....
void setDisplayOnlyVisibleFeatures(bool visibleOnly)
Sets the attribute table to only show features which are visible in a map item.
Wrapper for iterator of features from vector data provider or vector layer.
@ LayoutAttributeTable
Attribute table.
QgsTextFormat mContentTextFormat
bool isEmpty() const
Returns true if the rectangle is empty.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
bool writePropertiesToElement(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override
Stores multiframe state within an XML DOM element.
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
void resetColumns()
Resets the attribute table's columns to match the vector layer's fields.
QgsTextFormat textFormatForCell(int row, int column) const override
Returns the text format to use for the cell at the specified row and column.
ContentSource source() const
Returns the source for attributes shown in the table body.
QgsLayoutItemMap * map() const
Returns the layout map whose extents are controlling the features shown in the table.
QgsExpressionContextScope * scopeForCell(int row, int column) const override
Creates a new QgsExpressionContextScope for the cell at row, column.
void setSource(ContentSource source)
Sets the source for attributes to show in table body.
DataDefinedProperty
Data defined properties for different item types.
QPolygonF visibleExtentPolygon() const
Returns a polygon representing the current visible map extent, considering map extents and rotation.
TYPE * get() const
Returns a pointer to the layer, or nullptr if the reference has not yet been matched to a layer.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
Encapsulate a field in an attribute table or data source.