16 #ifndef QGSFEATUREFILTERMODEL_H 17 #define QGSFEATUREFILTERMODEL_H 19 #include <QAbstractItemModel> 24 class QgsFieldExpressionValuesGatherer;
37 Q_PROPERTY(
QgsVectorLayer *sourceLayer READ sourceLayer WRITE setSourceLayer NOTIFY sourceLayerChanged )
38 Q_PROPERTY( QString displayExpression READ displayExpression WRITE setDisplayExpression NOTIFY displayExpressionChanged )
39 Q_PROPERTY( QString filterValue READ filterValue WRITE setFilterValue NOTIFY filterValueChanged )
40 Q_PROPERTY( QString filterExpression READ filterExpression WRITE setFilterExpression NOTIFY filterExpressionChanged )
41 Q_PROPERTY(
bool allowNull READ allowNull WRITE setAllowNull NOTIFY allowNullChanged )
42 Q_PROPERTY(
bool isLoading READ isLoading NOTIFY isLoadingChanged )
49 Q_PROPERTY( QString identifierField READ identifierField WRITE setIdentifierField NOTIFY identifierFieldChanged )
54 Q_PROPERTY( QVariant extraIdentifierValue READ extraIdentifierValue WRITE setExtraIdentifierValue NOTIFY extraIdentifierValueChanged )
56 Q_PROPERTY(
int extraIdentifierValueIndex READ extraIdentifierValueIndex NOTIFY extraIdentifierValueIndexChanged )
65 IdentifierValueRole = Qt::UserRole,
91 QString displayExpression()
const;
99 void setDisplayExpression(
const QString &displayExpression );
106 QString filterValue()
const;
113 void setFilterValue(
const QString &filterValue );
115 QModelIndex index(
int row,
int column,
const QModelIndex &parent )
const override;
116 QModelIndex parent(
const QModelIndex &child )
const override;
117 int rowCount(
const QModelIndex &parent )
const override;
118 int columnCount(
const QModelIndex &parent )
const override;
119 QVariant data(
const QModelIndex &index,
int role )
const override;
125 QString filterExpression()
const;
131 void setFilterExpression(
const QString &filterExpression );
136 bool isLoading()
const;
142 QString identifierField()
const;
148 void setIdentifierField(
const QString &identifierField );
154 QVariant extraIdentifierValue()
const;
160 void setExtraIdentifierValue(
const QVariant &extraIdentifierValue );
165 int extraIdentifierValueIndex()
const;
170 bool extraValueDoesNotExist()
const;
175 bool allowNull()
const;
180 void setAllowNull(
bool allowNull );
187 void sourceLayerChanged();
195 void displayExpressionChanged();
202 void filterValueChanged();
208 void filterExpressionChanged();
213 void isLoadingChanged();
219 void identifierFieldChanged();
224 void filterJobCompleted();
230 void extraIdentifierValueChanged();
235 void extraIdentifierValueIndexChanged(
int index );
240 void extraValueDoesNotExistChanged();
255 void allowNullChanged();
258 void updateCompleter();
259 void gathererThreadFinished();
260 void scheduledReload();
263 QSet<QString> requestedAttributes()
const;
264 void setExtraIdentifierValueIndex(
int index );
265 void setExtraValueDoesNotExist(
bool extraValueDoesNotExist );
267 void reloadCurrentFeature();
268 void setExtraIdentifierValueUnguarded(
const QVariant &extraIdentifierValue );
273 Entry(
const QVariant &_identifierValue,
const QString &_value,
const QgsFeature &_feature )
274 : identifierValue( _identifierValue )
276 , feature( _feature )
279 QVariant identifierValue;
283 bool operator()(
const Entry &lhs,
const Entry &rhs )
const;
289 QgsExpression mDisplayExpression;
290 QString mFilterValue;
291 QString mFilterExpression;
294 mutable QMap< QgsFeatureId, QgsConditionalStyle > mEntryStylesMap;
295 QVector<Entry> mEntries;
296 QgsFieldExpressionValuesGatherer *mGatherer =
nullptr;
298 bool mShouldReloadCurrentFeature =
false;
299 bool mExtraValueDoesNotExist =
false;
300 bool mAllowNull =
false;
302 QString mIdentifierField;
304 QVariant mExtraIdentifierValue;
306 int mExtraIdentifierValueIndex = -1;
308 friend class QgsFieldExpressionValuesGatherer;
311 #endif // QGSFEATUREFILTERMODEL_H 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.