15 #ifndef QGSFEATUREFILTERMODEL_H 16 #define QGSFEATUREFILTERMODEL_H 18 #include <QAbstractItemModel> 22 class QgsFieldExpressionValuesGatherer;
35 Q_PROPERTY(
QgsVectorLayer *sourceLayer READ sourceLayer WRITE setSourceLayer NOTIFY sourceLayerChanged )
36 Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
37 Q_PROPERTY( QString filterValue READ filterValue WRITE setFilterValue NOTIFY filterValueChanged )
38 Q_PROPERTY( QString filterExpression READ filterExpression WRITE setFilterExpression NOTIFY filterExpressionChanged )
39 Q_PROPERTY(
bool allowNull READ allowNull WRITE setAllowNull NOTIFY allowNullChanged )
40 Q_PROPERTY(
bool isLoading READ isLoading NOTIFY isLoadingChanged )
47 Q_PROPERTY( QString identifierField READ identifierField WRITE setIdentifierField NOTIFY identifierFieldChanged )
52 Q_PROPERTY( QVariant extraIdentifierValue READ extraIdentifierValue WRITE setExtraIdentifierValue NOTIFY extraIdentifierValueChanged )
54 Q_PROPERTY(
int extraIdentifierValueIndex READ extraIdentifierValueIndex NOTIFY extraIdentifierValueIndexChanged )
63 IdentifierValueRole = Qt::UserRole,
90 QString displayExpression()
const;
98 void setDisplayExpression(
const QString &displayExpression );
105 QString filterValue()
const;
112 void setFilterValue(
const QString &filterValue );
114 QModelIndex index(
int row,
int column,
const QModelIndex &parent )
const override;
115 QModelIndex parent(
const QModelIndex &child )
const override;
116 int rowCount(
const QModelIndex &parent )
const override;
117 int columnCount(
const QModelIndex &parent )
const override;
118 QVariant data(
const QModelIndex &index,
int role )
const override;
124 QString filterExpression()
const;
130 void setFilterExpression(
const QString &filterExpression );
135 bool isLoading()
const;
143 Q_DECL_DEPRECATED QString identifierField()
const;
150 QStringList identifierFields()
const;
157 Q_DECL_DEPRECATED
void setIdentifierField(
const QString &identifierField );
165 void setIdentifierFields(
const QStringList &identifierFields );
172 Q_DECL_DEPRECATED QVariant extraIdentifierValue()
const;
179 QVariantList extraIdentifierValues()
const;
186 Q_DECL_DEPRECATED
void setExtraIdentifierValue(
const QVariant &extraIdentifierValue );
193 void setExtraIdentifierValues(
const QVariantList &extraIdentifierValues );
200 void setExtraIdentifierValuesToNull();
205 int extraIdentifierValueIndex()
const;
210 bool extraValueDoesNotExist()
const;
215 bool allowNull()
const;
220 void setAllowNull(
bool allowNull );
227 void sourceLayerChanged();
235 void displayExpressionChanged();
242 void filterValueChanged();
248 void filterExpressionChanged();
253 void isLoadingChanged();
259 void identifierFieldChanged();
264 void filterJobCompleted();
270 void extraIdentifierValueChanged();
275 void extraIdentifierValueIndexChanged(
int index );
280 void extraValueDoesNotExistChanged();
295 void allowNullChanged();
298 void updateCompleter();
299 void gathererThreadFinished();
300 void scheduledReload();
303 QSet<QString> requestedAttributes()
const;
304 void setExtraIdentifierValuesIndex(
int index,
bool force =
false );
305 void setExtraValueDoesNotExist(
bool extraValueDoesNotExist );
307 void reloadCurrentFeature();
308 void setExtraIdentifierValuesUnguarded(
const QVariantList &extraIdentifierValues );
313 Entry(
const QVariantList &_identifierValues,
const QString &_value,
const QgsFeature &_feature )
314 : identifierValues( _identifierValues )
316 , feature( _feature )
319 QVariantList identifierValues;
323 bool operator()(
const Entry &lhs,
const Entry &rhs )
const;
331 QString mFilterValue;
332 QString mFilterExpression;
335 mutable QMap< QgsFeatureId, QgsConditionalStyle > mEntryStylesMap;
336 QVector<Entry> mEntries;
337 QgsFieldExpressionValuesGatherer *mGatherer =
nullptr;
339 bool mShouldReloadCurrentFeature =
false;
340 bool mExtraValueDoesNotExist =
false;
341 bool mAllowNull =
false;
342 bool mIsSettingExtraIdentifierValue =
false;
344 QStringList mIdentifierFields;
345 QVariantList mExtraIdentifierValues;
347 int mExtraIdentifierValueIndex = -1;
349 friend class QgsFieldExpressionValuesGatherer;
352 #endif // QGSFEATUREFILTERMODEL_H Class for parsing and evaluation of expressions (formerly called "search strings").
Provides a list of features based on filter conditions.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Role
Extra roles that can be used to fetch data from this model.
Conditional styling for a rule.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Represents a vector layer which manages a vector based data sets.
Used to retrieve the identifierValues (primary keys) of a feature.