70 return tr(
"<Attribute table frame>" );
75 if ( layer == mVectorLayer.
get() )
113 QgsRelation relation =
mLayout->project()->relationManager()->relation( mRelationId );
135 void QgsLayoutItemAttributeTable::atlasLayerChanged(
QgsVectorLayer *layer )
144 if ( mCurrentAtlasLayer )
150 const bool mustRebuildColumns =
static_cast< bool >( mCurrentAtlasLayer ) ||
mColumns.empty();
151 mCurrentAtlasLayer = layer;
153 if ( mustRebuildColumns )
181 for (
const auto &
field : sourceFields )
183 QString currentAlias =
source->attributeDisplayName( idx );
192 void QgsLayoutItemAttributeTable::disconnectCurrentMap()
201 disconnect( mMap, &QObject::destroyed,
this, &QgsLayoutItemAttributeTable::disconnectCurrentMap );
207 return mUseConditionalStyling;
229 disconnectCurrentMap();
237 connect( mMap, &QObject::destroyed,
this, &QgsLayoutItemAttributeTable::disconnectCurrentMap );
245 if ( features == mMaximumNumberOfFeatures )
250 mMaximumNumberOfFeatures = features;
257 if ( uniqueOnly == mShowUniqueRowsOnly )
262 mShowUniqueRowsOnly = uniqueOnly;
269 if ( visibleOnly == mShowOnlyVisibleFeatures )
274 mShowOnlyVisibleFeatures = visibleOnly;
281 if ( filterToAtlas == mFilterToAtlasIntersection )
286 mFilterToAtlasIntersection = filterToAtlas;
293 if ( filter == mFilterFeatures )
298 mFilterFeatures = filter;
305 if ( expression == mFeatureFilter )
310 mFeatureFilter = expression;
328 if ( !fields.isEmpty() )
330 for (
const QString &
field : fields )
337 QString currentAlias =
source->attributeDisplayName( attrIdx );
350 QString currentAlias =
source->attributeDisplayName( idx );
365 void QgsLayoutItemAttributeTable::restoreFieldAliasMap(
const QMap<int, QString> &map )
373 for (
int i = 0; i <
mColumns.count(); i++ )
375 int attrIdx =
source->fields().lookupField(
mColumns[i].attribute() );
376 if (
map.contains( attrIdx ) )
382 mColumns[i].setHeading(
source->attributeDisplayName( attrIdx ) );
407 std::unique_ptr<QgsExpression> filterExpression;
408 bool activeFilter =
false;
409 if ( mFilterFeatures && !mFeatureFilter.isEmpty() )
411 filterExpression = qgis::make_unique< QgsExpression >( mFeatureFilter );
412 if ( !filterExpression->hasParserError() )
419 #ifdef HAVE_SERVER_PYTHON_PLUGINS
420 if (
mLayout->renderContext().featureFilterProvider() )
422 mLayout->renderContext().featureFilterProvider()->filterFeatures( layer, req );
428 std::unique_ptr< QgsGeometryEngine > visibleMapEngine;
429 if ( mMap && mShowOnlyVisibleFeatures )
446 visibleMapEngine->prepareGeometry();
450 std::unique_ptr< QgsGeometryEngine > atlasGeometryEngine;
451 if ( mFilterToAtlasIntersection )
453 atlasGeometry =
mLayout->reportContext().currentGeometry( layer->
crs() );
454 if ( !atlasGeometry.
isNull() )
456 if ( selectionRect.
isNull() )
466 atlasGeometryEngine->prepareGeometry();
472 QgsRelation relation =
mLayout->project()->relationManager()->relation( mRelationId );
477 if ( !selectionRect.
isEmpty() )
491 req.
addOrderBy( column.attribute(), column.sortOrder() == Qt::AscendingOrder );
498 mConditionalStyles.clear();
501 QVector< QVector< Cell > > tempContents;
504 while ( fit.
nextFeature( f ) && counter < mMaximumNumberOfFeatures )
508 if ( activeFilter && filterExpression )
510 QVariant result = filterExpression->evaluate( &context );
512 if ( !result.toBool() )
519 if ( visibleMapEngine )
529 if ( mFilterToAtlasIntersection )
542 if ( mUseConditionalStyling )
553 QVector< Cell > currentRow;
554 #ifdef HAVE_SERVER_PYTHON_PLUGINS
557 currentRow.reserve(
mColumns.count() );
559 rowContents.reserve(
mColumns.count() );
569 const QVariant val = f.
attributes().at( idx );
571 if ( mUseConditionalStyling )
575 styles.insert( 0, rowStyle );
579 QVariant v = replaceWrapChar( val );
580 currentRow << Cell( v, style, f );
586 std::unique_ptr< QgsExpression > expression = qgis::make_unique< QgsExpression >( column.attribute() );
588 expression->prepare( &context );
589 QVariant value = expression->evaluate( &context );
591 currentRow << Cell( value, rowStyle, f );
592 rowContents << value;
596 if ( mShowUniqueRowsOnly )
602 tempContents << currentRow;
603 existingContents << rowContents;
608 contents.reserve( tempContents.size() );
609 mConditionalStyles.reserve( tempContents.size() );
610 mFeatures.reserve( tempContents.size() );
611 for (
auto it = tempContents.constBegin(); it != tempContents.constEnd(); ++it )
614 QList< QgsConditionalStyle > rowStyles;
615 row.reserve( it->size() );
616 rowStyles.reserve( it->size() );
618 for (
auto cellIt = it->constBegin(); cellIt != it->constEnd(); ++cellIt )
620 row << cellIt->content;
621 rowStyles << cellIt->style;
622 if ( cellIt == it->constBegin() )
623 mFeatures << cellIt->feature;
626 mConditionalStyles << rowStyles;
635 if ( row >= mConditionalStyles.size() )
638 return mConditionalStyles.at( row ).at( column );
644 scope->setFeature( mFeatures.value( row ) );
645 scope->setFields( scope->feature().fields() );
646 return scope.release();
664 if ( !mMap && !mMapUuid.isEmpty() &&
mLayout )
666 mMap = qobject_cast< QgsLayoutItemMap *>(
mLayout->itemByUuid( mMapUuid,
true ) );
683 mDataDefinedVectorLayer =
nullptr;
685 QString currentLayerIdentifier;
687 currentLayerIdentifier = currentLayer->id();
692 mDataDefinedVectorLayer = ddLayer;
698 QVariant QgsLayoutItemAttributeTable::replaceWrapChar(
const QVariant &variant )
const
701 if ( mWrapString.isEmpty() || !variant.toString().contains( mWrapString ) )
704 QString replaced = variant.toString();
705 replaced.replace( mWrapString, QLatin1String(
"\n" ) );
709 #ifdef HAVE_SERVER_PYTHON_PLUGINS
716 if (
mLayout->renderContext().featureFilterProvider() )
723 return allowedColumns;
726 QHash<const QString, QSet<QString>> columnAttributesMap;
727 QSet<QString> allowedAttributes;
729 for (
const auto &
c : qgis::as_const( allowedColumns ) )
731 if ( !
c.attribute().isEmpty() && ! columnAttributesMap.contains(
c.attribute() ) )
733 columnAttributesMap[
c.attribute() ] = QSet<QString>();
736 for (
const auto &cref : constRefs )
738 columnAttributesMap[
c.attribute() ].insert( cref->name() );
739 allowedAttributes.insert( cref->name() );
745 #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
746 const QSet<QString> filteredAttributesSet( filteredAttributes.constBegin(), filteredAttributes.constEnd() );
748 const QSet<QString> filteredAttributesSet { filteredAttributes.toSet() };
750 if ( filteredAttributesSet != allowedAttributes )
752 const auto forbidden { allowedAttributes.subtract( filteredAttributesSet ) };
753 allowedColumns.erase( std::remove_if( allowedColumns.begin(), allowedColumns.end(), [ &columnAttributesMap, &forbidden ](
QgsLayoutTableColumn &
c ) ->
bool
755 for ( const auto &f : qgis::as_const( forbidden ) )
757 if ( columnAttributesMap[ c.attribute() ].contains( f ) )
763 } ), allowedColumns.end() );
768 return allowedColumns;
777 return mLayout->reportContext().layer();
780 if ( mDataDefinedVectorLayer )
781 return mDataDefinedVectorLayer;
783 return mVectorLayer.
get();
787 QgsRelation relation =
mLayout->project()->relationManager()->relation( mRelationId );
794 void QgsLayoutItemAttributeTable::removeLayer(
const QString &layerId )
798 if ( layerId == mVectorLayer->
id() )
824 tableElem.setAttribute( QStringLiteral(
"source" ), QString::number(
static_cast< int >( mSource ) ) );
825 tableElem.setAttribute( QStringLiteral(
"relationId" ), mRelationId );
826 tableElem.setAttribute( QStringLiteral(
"showUniqueRowsOnly" ), mShowUniqueRowsOnly );
827 tableElem.setAttribute( QStringLiteral(
"showOnlyVisibleFeatures" ), mShowOnlyVisibleFeatures );
828 tableElem.setAttribute( QStringLiteral(
"filterToAtlasIntersection" ), mFilterToAtlasIntersection );
829 tableElem.setAttribute( QStringLiteral(
"maxFeatures" ), mMaximumNumberOfFeatures );
830 tableElem.setAttribute( QStringLiteral(
"filterFeatures" ), mFilterFeatures ? QStringLiteral(
"true" ) : QStringLiteral(
"false" ) );
831 tableElem.setAttribute( QStringLiteral(
"featureFilter" ), mFeatureFilter );
832 tableElem.setAttribute( QStringLiteral(
"wrapString" ), mWrapString );
833 tableElem.setAttribute( QStringLiteral(
"useConditionalStyling" ), mUseConditionalStyling );
837 tableElem.setAttribute( QStringLiteral(
"mapUuid" ), mMap->
uuid() );
842 tableElem.setAttribute( QStringLiteral(
"vectorLayer" ), mVectorLayer.
layerId );
843 tableElem.setAttribute( QStringLiteral(
"vectorLayerName" ), mVectorLayer.
name );
844 tableElem.setAttribute( QStringLiteral(
"vectorLayerSource" ), mVectorLayer.
source );
845 tableElem.setAttribute( QStringLiteral(
"vectorLayerProvider" ), mVectorLayer.
provider );
862 mRelationId = itemElem.attribute( QStringLiteral(
"relationId" ), QString() );
866 mCurrentAtlasLayer =
mLayout->reportContext().layer();
869 mShowUniqueRowsOnly = itemElem.attribute( QStringLiteral(
"showUniqueRowsOnly" ), QStringLiteral(
"0" ) ).toInt();
870 mShowOnlyVisibleFeatures = itemElem.attribute( QStringLiteral(
"showOnlyVisibleFeatures" ), QStringLiteral(
"1" ) ).toInt();
871 mFilterToAtlasIntersection = itemElem.attribute( QStringLiteral(
"filterToAtlasIntersection" ), QStringLiteral(
"0" ) ).toInt();
872 mFilterFeatures = itemElem.attribute( QStringLiteral(
"filterFeatures" ), QStringLiteral(
"false" ) ) == QLatin1String(
"true" );
873 mFeatureFilter = itemElem.attribute( QStringLiteral(
"featureFilter" ), QString() );
874 mMaximumNumberOfFeatures = itemElem.attribute( QStringLiteral(
"maxFeatures" ), QStringLiteral(
"5" ) ).toInt();
875 mWrapString = itemElem.attribute( QStringLiteral(
"wrapString" ) );
876 mUseConditionalStyling = itemElem.attribute( QStringLiteral(
"useConditionalStyling" ), QStringLiteral(
"0" ) ).toInt();
879 mMapUuid = itemElem.attribute( QStringLiteral(
"mapUuid" ) );
889 QString layerId = itemElem.attribute( QStringLiteral(
"vectorLayer" ) );
890 QString layerName = itemElem.attribute( QStringLiteral(
"vectorLayerName" ) );
891 QString layerSource = itemElem.attribute( QStringLiteral(
"vectorLayerSource" ) );
892 QString layerProvider = itemElem.attribute( QStringLiteral(
"vectorLayerProvider" ) );
893 mVectorLayer =
QgsVectorLayerRef( layerId, layerName, layerSource, layerProvider );
917 if ( newLayer != prevLayer )
929 mCurrentAtlasLayer = newLayer;
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.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
The QgsConditionalLayerStyles class holds conditional style information for a layer.
QgsConditionalStyles rowStyles() const
Returns a list of row styles associated with the layer.
QList< QgsConditionalStyle > fieldStyles(const QString &fieldName) const
Returns the conditional styles set for the field with matching fieldName.
Conditional styling for a rule.
static QgsConditionalStyle compressStyles(const QList< QgsConditionalStyle > &styles)
Compress a list of styles into a single style.
static QList< QgsConditionalStyle > matchingConditionalStyles(const QList< QgsConditionalStyle > &styles, const QVariant &value, QgsExpressionContext &context)
Find and return the matching styles for the value and feature.
Custom exception class for Coordinate Reference System related exceptions.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
void setFields(const QgsFields &fields)
Convenience function for setting a fields for the context.
An expression node which takes it value from a feature's field.
Class for parsing and evaluation of expressions (formerly called "search strings").
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.
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
This class wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.
QgsFeatureRequest & addOrderBy(const QString &expression, bool ascending=true)
Adds a new OrderByClause, appending it as the least important one.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
@ ExactIntersect
Use exact geometry intersection (slower) instead of bounding boxes.
QgsFeatureRequest & setExpressionContext(const QgsExpressionContext &context)
Sets the expression context used to evaluate filter expressions.
QgsFeatureRequest & setFilterFid(QgsFeatureId fid)
Sets feature ID that should be fetched.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rectangle)
Sets the rectangle from which features will be taken.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
A geometry is the spatial representation of a feature.
const QgsAbstractGeometry * constGet() const SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
static QgsGeometry fromQPolygonF(const QPolygonF &polygon)
Construct geometry from a QPolygonF.
static QgsGeometryEngine * createGeometryEngine(const QgsAbstractGeometry *geometry)
Creates and returns a new geometry engine.
OperationResult transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
A layout table subclass that displays attributes from a vector layer.
void resetColumns()
Resets the attribute table's columns to match the vector layer's fields.
QString wrapString() const
Returns the string used to wrap the contents of the table cells by.
bool readPropertiesFromElement(const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override
Sets multiframe state from a DOM element.
ContentSource
Specifies the content source for the attribute table.
@ AtlasFeature
Table shows attributes from the current atlas feature.
@ RelationChildren
Table shows attributes from related child features.
@ LayerAttributes
Table shows attributes from features in a vector layer.
QgsVectorLayer * sourceLayer() const
Returns the source layer for the table, considering the table source mode.
void setDisplayedFields(const QStringList &fields, bool refresh=true)
Sets the attributes to display in the table.
void setUseConditionalStyling(bool enabled)
Sets whether the attribute table will be rendered using the conditional styling properties of the lin...
void setRelationId(const QString &id)
Sets the relation id from which to display child features.
void setMaximumNumberOfFeatures(int features)
Sets the maximum number of features shown by 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.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
void finalizeRestoreFromXml() override
Called after all pending items have been restored from XML.
bool useConditionalStyling() const
Returns true if the attribute table will be rendered using the conditional styling properties of the ...
ContentSource source() const
Returns the source for attributes shown in the table body.
int type() const override
Returns unique multiframe type id.
QgsConditionalStyle conditionalCellStyle(int row, int column) const override
Returns the conditional style to use for the cell at row, column.
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...
QgsExpressionContextScope * scopeForCell(int row, int column) const override
Creates a new QgsExpressionContextScope for the cell at row, column.
void setFilterFeatures(bool filter)
Sets whether the feature filter is active for the attribute table.
void setUniqueRowsOnly(bool uniqueOnly)
Sets attribute table to only show unique rows.
QString relationId() const
Returns the relation id which the table displays child features from.
void setWrapString(const QString &wrapString)
Sets a string to wrap the contents of the table cells by.
QIcon icon() const override
Returns the item's icon.
void setMap(QgsLayoutItemMap *map)
Sets a layout map to use to limit the extent of features shown in the attribute table.
QgsLayoutItemMap * map() const
Returns the layout map whose extents are controlling the features shown in the table.
void setFilterToAtlasFeature(bool filterToAtlas)
Sets attribute table to only show features which intersect the current atlas feature.
QString displayName() const override
Returns the multiframe display name.
bool writePropertiesToElement(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override
Stores multiframe state within an XML DOM element.
bool getTableContents(QgsLayoutTableContents &contents) override
Queries the attribute table's vector layer for attributes to show in the table.
QgsLayoutItemAttributeTable(QgsLayout *layout)
Constructor for QgsLayoutItemAttributeTable, attached to the specified layout.
static QgsLayoutItemAttributeTable * create(QgsLayout *layout)
Returns a new QgsLayoutItemAttributeTable for the specified parent layout.
void setVectorLayer(QgsVectorLayer *layer)
Sets the vector layer from which to display feature attributes.
void setSource(ContentSource source)
Sets the source for attributes to show in table body.
Layout graphical items for displaying a map.
void extentChanged()
Emitted when the map's extent changes.
void mapRotationChanged(double newRotation)
Emitted when the map's rotation changes.
QPolygonF visibleExtentPolygon() const
Returns a polygon representing the current visible map extent, considering map extents and rotation.
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used for rendering the map.
@ LayoutAttributeTable
Attribute table.
virtual QString uuid() const
Returns the item identification string.
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
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...
QgsPropertyCollection mDataDefinedProperties
const QgsLayout * layout() const
Returns the layout the object is attached to.
void changed()
Emitted when the object's properties change.
QPointer< QgsLayout > mLayout
DataDefinedProperty
Data defined properties for different item types.
@ AttributeTableSourceLayer
Attribute table source layer.
@ AllProperties
All properties for item.
QgsFeatureFilterProvider * featureFilterProvider() const
Returns the possibly NULL feature filter provider.
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
Stores properties of a column for a QgsLayoutTable.
void setAttribute(const QString &attribute)
Sets the attribute name or expression used for the column's values.
void setHeading(const QString &heading)
Sets the heading for a column, which is the value displayed in the column's header cell.
A class to display a table in the print layout, and allow the table to span over multiple frames.
virtual void refreshAttributes()
Refreshes the contents shown in the table by querying for new data.
void recalculateTableSize()
Recalculates and updates the size of the table and all table frames.
virtual QgsExpressionContextScope * scopeForCell(int row, int column) const
Creates a new QgsExpressionContextScope for the cell at row, column.
QgsLayoutTableContents & contents()
Returns the current contents of the table.
bool contentsContainsRow(const QgsLayoutTableContents &contents, const QgsLayoutTableRow &row) const
Checks whether a table contents contains a given row.
QgsLayoutTableColumns mColumns
Columns to show in table.
bool writePropertiesToElement(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override
Stores multiframe state within an XML DOM element.
QgsLayoutTableSortColumns mSortColumns
Columns to sort the table.
bool readPropertiesFromElement(const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override
Sets multiframe state from a DOM element.
static QgsMapLayer * mapLayerFromString(const QString &string, QgsProject *project)
Resolves a string into a map layer from a given project.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
QgsLayoutRenderContext & renderContext()
Returns a reference to the layout's render context, which stores information relating to the current ...
QgsCoordinateReferenceSystem crs
QString id() const
Returns the layer's unique ID, which is used to access this layer from QgsProject.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
void layerWillBeRemoved(const QString &layerId)
Emitted when a layer is about to be removed from the registry.
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
bool isNull() const
Test if the rectangle is null (all coordinates zero or after call to setMinimal()).
bool isEmpty() const
Returns true if the rectangle is empty.
QgsRectangle intersect(const QgsRectangle &rect) const
Returns the intersection with the given rectangle.
QgsVectorLayer * referencingLayer
QgsFeatureRequest getRelatedFeaturesRequest(const QgsFeature &feature) const
Creates a request to return all the features on the referencing (child) layer which have a foreign ke...
Represents a vector layer which manages a vector based data sets.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const FINAL
Queries the layer for features specified in request.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
void layerModified()
Emitted when modifications has been done on layer.
QgsConditionalLayerStyles * conditionalStyles() const
Returns the conditional styles that are set for this layer.
QVector< QgsLayoutTableColumn > QgsLayoutTableColumns
List of column definitions for a QgsLayoutTable.
QVector< QgsLayoutTableRow > QgsLayoutTableContents
List of QgsLayoutTableRows, representing rows and column cell contents for a QgsLayoutTable.
QVector< QVariant > QgsLayoutTableRow
List of QVariants, representing a the contents of a single row in a QgsLayoutTable.
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
_LayerRef< QgsVectorLayer > QgsVectorLayerRef
Single variable definition for use within a QgsExpressionContextScope.
QString source
Weak reference to layer public source.
QString name
Weak reference to layer name.
TYPE * get() const
Returns a pointer to the layer, or nullptr if the reference has not yet been matched to a layer.
QString provider
Weak reference to layer provider.
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.
void setLayer(TYPE *l)
Sets the reference to point to a specified layer.
QString layerId
Original layer ID.