16 #ifndef QGSFEATUREFILTERMODEL_P_H 17 #define QGSFEATUREFILTERMODEL_P_H 36 class QgsFieldExpressionValuesGatherer:
public QThread
43 , mDisplayExpression( displayExpression )
45 , mIdentifierField( identifierField )
53 mIterator = mSource->getFeatures( mRequest );
55 mDisplayExpression.prepare( &mExpressionContext );
58 const int attribute = mSource->
fields().
indexOf( mIdentifierField );
60 while ( mIterator.nextFeature( feat ) )
62 mExpressionContext.setFeature( feat );
63 mEntries.append( QgsFeatureFilterModel::Entry( feat.
attribute( attribute ), mDisplayExpression.evaluate( &mExpressionContext ).toString(), feat ) );
69 emit collectedValues();
79 bool wasCanceled()
const {
return mWasCanceled; }
81 QVector<QgsFeatureFilterModel::Entry> entries()
const 102 void setData(
const QVariant &data )
113 void collectedValues();
117 std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
118 QgsExpression mDisplayExpression;
122 bool mWasCanceled =
false;
123 QVector<QgsFeatureFilterModel::Entry> mEntries;
124 QString mIdentifierField;
131 #endif // QGSFEATUREFILTERMODEL_P_H Wrapper for iterator of features from vector data provider or vector layer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Partial snapshot of vector layer's state (only the members necessary for access to features) ...
int indexOf(const QString &fieldName) const
Get the field index from the field name.
Represents a vector layer which manages a vector based data sets.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.