15 #ifndef QGSFEATUREFILTERMODEL_P_H 16 #define QGSFEATUREFILTERMODEL_P_H 34 class QgsFieldExpressionValuesGatherer:
public QThread
40 const QString &displayExpression,
41 const QStringList &identifierFields,
44 , mDisplayExpression( displayExpression )
46 , mIdentifierFields( identifierFields )
54 mIterator = mSource->getFeatures( mRequest );
56 mDisplayExpression.prepare( &mExpressionContext );
60 for (
const QString &fieldName : qgis::as_const( mIdentifierFields ) )
61 attributeIndexes << mSource->fields().indexOf( fieldName );
63 while ( mIterator.nextFeature( feat ) )
65 mExpressionContext.setFeature( feat );
66 QVariantList attributes;
67 for (
const int idx : attributeIndexes )
69 mEntries.append( QgsFeatureFilterModel::Entry( attributes, mDisplayExpression.evaluate( &mExpressionContext ).toString(), feat ) );
75 emit collectedValues();
85 bool wasCanceled()
const {
return mWasCanceled; }
87 QVector<QgsFeatureFilterModel::Entry> entries()
const 100 QVariant data()
const 108 void setData(
const QVariant &data )
119 void collectedValues();
123 std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
128 bool mWasCanceled =
false;
129 QVector<QgsFeatureFilterModel::Entry> mEntries;
130 QStringList mIdentifierFields;
137 #endif // QGSFEATUREFILTERMODEL_P_H Class for parsing and evaluation of expressions (formerly called "search strings").
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...
const QgsAttributeList & attributeIndexes
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) ...
Represents a vector layer which manages a vector based data sets.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.