File tree 3 files changed +17
-2
lines changed
3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ Setup the simplification of geometries to fetch using the specified simplify met
153
153
154
154
155
155
156
- class QgsVectorLayerSelectedFeatureSource : QgsFeatureSource
156
+ class QgsVectorLayerSelectedFeatureSource : QgsFeatureSource, QgsExpressionContextScopeGenerator
157
157
{
158
158
%Docstring
159
159
QgsFeatureSource subclass for the selected features from a :py:class:`QgsVectorLayer`.
@@ -185,6 +185,8 @@ the QgsVectorLayerSelectedFeatureSource will not be reflected.
185
185
186
186
virtual QString sourceName() const;
187
187
188
+ virtual QgsExpressionContextScope *createExpressionContextScope() const;
189
+
188
190
189
191
190
192
};
Original file line number Diff line number Diff line change @@ -1083,6 +1083,7 @@ QgsVectorLayerSelectedFeatureSource::QgsVectorLayerSelectedFeatureSource( QgsVec
1083
1083
, mSelectedFeatureIds( layer->selectedFeatureIds () )
1084
1084
, mWkbType( layer->wkbType () )
1085
1085
, mName( layer->name () )
1086
+ , mLayer( layer )
1086
1087
{}
1087
1088
1088
1089
QgsFeatureIterator QgsVectorLayerSelectedFeatureSource::getFeatures ( const QgsFeatureRequest &request ) const
@@ -1127,3 +1128,11 @@ QString QgsVectorLayerSelectedFeatureSource::sourceName() const
1127
1128
{
1128
1129
return mName ;
1129
1130
}
1131
+
1132
+ QgsExpressionContextScope *QgsVectorLayerSelectedFeatureSource::createExpressionContextScope () const
1133
+ {
1134
+ if ( mLayer )
1135
+ return mLayer ->createExpressionContextScope ();
1136
+ else
1137
+ return nullptr ;
1138
+ }
Original file line number Diff line number Diff line change 21
21
#include " qgsfields.h"
22
22
#include " qgscoordinatereferencesystem.h"
23
23
#include " qgsfeaturesource.h"
24
+ #include " qgsexpressioncontextscopegenerator.h"
24
25
26
+ #include < QPointer>
25
27
#include < QSet>
26
28
#include < memory>
27
29
@@ -285,7 +287,7 @@ class CORE_EXPORT QgsVectorLayerFeatureIterator : public QgsAbstractFeatureItera
285
287
* QgsFeatureSource subclass for the selected features from a QgsVectorLayer.
286
288
* \since QGIS 3.0
287
289
*/
288
- class CORE_EXPORT QgsVectorLayerSelectedFeatureSource : public QgsFeatureSource
290
+ class CORE_EXPORT QgsVectorLayerSelectedFeatureSource : public QgsFeatureSource, public QgsExpressionContextScopeGenerator
289
291
{
290
292
public:
291
293
@@ -302,6 +304,7 @@ class CORE_EXPORT QgsVectorLayerSelectedFeatureSource : public QgsFeatureSource
302
304
QgsWkbTypes::Type wkbType () const override ;
303
305
long featureCount () const override ;
304
306
QString sourceName () const override ;
307
+ QgsExpressionContextScope *createExpressionContextScope () const override ;
305
308
306
309
307
310
private:
@@ -311,6 +314,7 @@ class CORE_EXPORT QgsVectorLayerSelectedFeatureSource : public QgsFeatureSource
311
314
QgsFeatureIds mSelectedFeatureIds ;
312
315
QgsWkbTypes::Type mWkbType = QgsWkbTypes::Unknown;
313
316
QString mName ;
317
+ QPointer< QgsVectorLayer > mLayer ;
314
318
315
319
};
316
320
You can’t perform that action at this time.
0 commit comments