16 #ifndef QGSFEATUREFILTERMODEL_H 17 #define QGSFEATUREFILTERMODEL_H 19 #include <QAbstractItemModel> 23 class QgsFieldExpressionValuesGatherer;
36 Q_PROPERTY(
QgsVectorLayer *sourceLayer READ sourceLayer WRITE setSourceLayer NOTIFY sourceLayerChanged )
37 Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
38 Q_PROPERTY( QString filterValue READ filterValue WRITE setFilterValue NOTIFY filterValueChanged )
39 Q_PROPERTY( QString filterExpression READ filterExpression WRITE setFilterExpression NOTIFY filterExpressionChanged )
40 Q_PROPERTY(
bool allowNull READ allowNull WRITE setAllowNull NOTIFY allowNullChanged )
41 Q_PROPERTY(
bool isLoading READ isLoading NOTIFY isLoadingChanged )
48 Q_PROPERTY( QString identifierField READ identifierField WRITE setIdentifierField NOTIFY identifierFieldChanged )
53 Q_PROPERTY( QVariant extraIdentifierValue READ extraIdentifierValue WRITE setExtraIdentifierValue NOTIFY extraIdentifierValueChanged )
55 Q_PROPERTY(
int extraIdentifierValueIndex READ extraIdentifierValueIndex NOTIFY extraIdentifierValueIndexChanged )
64 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;
141 QString identifierField()
const;
147 void setIdentifierField(
const QString &identifierField );
153 QVariant extraIdentifierValue()
const;
159 void setExtraIdentifierValue(
const QVariant &extraIdentifierValue );
164 int extraIdentifierValueIndex()
const;
169 bool extraValueDoesNotExist()
const;
174 bool allowNull()
const;
179 void setAllowNull(
bool allowNull );
186 void sourceLayerChanged();
194 void displayExpressionChanged();
201 void filterValueChanged();
207 void filterExpressionChanged();
212 void isLoadingChanged();
218 void identifierFieldChanged();
223 void filterJobCompleted();
229 void extraIdentifierValueChanged();
234 void extraIdentifierValueIndexChanged(
int index );
239 void extraValueDoesNotExistChanged();
254 void allowNullChanged();
257 void updateCompleter();
258 void gathererThreadFinished();
259 void scheduledReload();
262 QSet<QString> requestedAttributes()
const;
263 void setExtraIdentifierValueIndex(
int index,
bool force =
false );
264 void setExtraValueDoesNotExist(
bool extraValueDoesNotExist );
266 void reloadCurrentFeature();
267 void setExtraIdentifierValueUnguarded(
const QVariant &extraIdentifierValue );
272 Entry(
const QVariant &_identifierValue,
const QString &_value,
const QgsFeature &_feature )
273 : identifierValue( _identifierValue )
275 , feature( _feature )
278 QVariant identifierValue;
282 bool operator()(
const Entry &lhs,
const Entry &rhs )
const;
289 QString mFilterValue;
290 QString mFilterExpression;
293 mutable QMap< QgsFeatureId, QgsConditionalStyle > mEntryStylesMap;
294 QVector<Entry> mEntries;
295 QgsFieldExpressionValuesGatherer *mGatherer =
nullptr;
297 bool mShouldReloadCurrentFeature =
false;
298 bool mExtraValueDoesNotExist =
false;
299 bool mAllowNull =
false;
300 bool mIsSettingExtraIdentifierValue =
false;
302 QString mIdentifierField;
304 QVariant mExtraIdentifierValue;
306 int mExtraIdentifierValueIndex = -1;
308 friend class QgsFieldExpressionValuesGatherer;
311 #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.