15#ifndef QGSFEATUREFILTERMODELBASE_H
16#define QGSFEATUREFILTERMODELBASE_H
21#include <QAbstractItemModel>
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;
122 QVariant data(
const QModelIndex &index,
int role )
const override;
128 QString filterExpression()
const;
134 void setFilterExpression(
const QString &filterExpression );
140 QString orderExpression()
const;
146 void setOrderExpression(
const QString &orderExpression );
152 Qt::SortOrder sortOrder()
const;
158 void setSortOrder(
const Qt::SortOrder sortOrder );
171 void setFormFeature(
const QgsFeature &feature );
183 void setParentFormFeature(
const QgsFeature &feature );
188 bool isLoading()
const;
352 void updateCompleter();
353 void scheduledReload();
387 virtual QgsFeatureExpressionValuesGatherer::Entry
createEntry(
const QVariant &identifier )
const = 0;
390 virtual QVariant
entryIdentifier(
const QgsFeatureExpressionValuesGatherer::Entry &entry )
const = 0;
393 virtual bool compareEntries(
const QgsFeatureExpressionValuesGatherer::Entry &a,
const QgsFeatureExpressionValuesGatherer::Entry &b )
const = 0;
404 QVector<QgsFeatureExpressionValuesGatherer::Entry>
mEntries;
414 void setExtraIdentifierValueIndex(
int index,
bool force =
false );
417 void reloadCurrentFeature();
418 QSet<QString> requestedAttributesForStyle()
const;
424 QString mFilterValue;
425 QString mFilterExpression;
427 Qt::SortOrder mSortOrder = Qt::AscendingOrder;
433 mutable QMap< QgsFeatureId, QgsConditionalStyle > mEntryStylesMap;
435 QgsFeatureExpressionValuesGatherer *mGatherer =
nullptr;
436 bool mFetchGeometry =
true;
437 int mFetchLimit = 100;
440 bool mShouldReloadCurrentFeature =
false;
441 bool mKeepCurrentEntry =
false;
442 bool mExtraValueDoesNotExist =
false;
443 bool mAllowNull =
false;
444 bool mIsSettingExtraIdentifierValue =
false;
Conditional styling for a rule.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Handles parsing and evaluation of expressions (formerly called "search strings").
Provides a list of features based on filter conditions.
void extraIdentifierValueIndexChanged(int index)
The index at which the extra identifier value is available within the model.
void beginUpdate()
Notification that the model is about to be changed because a job was completed.
virtual QVariant entryIdentifier(const QgsFeatureExpressionValuesGatherer::Entry &entry) const =0
Returns the identifier of the given entry.
void filterValueChanged()
This value will be used to filter the features available from this model.
void setFilterValue(const QString &filterValue)
This value will be used to filter the features available from this model.
virtual void setExtraIdentifierValueToNull()=0
Allows specifying one value that does not need to match the filter criteria but will still be availab...
void setExtraIdentifierValue(const QVariant &extraIdentifierValue)
Allows specifying one value that does not need to match the filter criteria but will still be availab...
virtual void requestToReloadCurrentFeature(QgsFeatureRequest &request)=0
Update the request to match the current feature to be reloaded.
void parentFormFeatureChanged()
A parent attribute form feature to be used alongside the filter expression.
void filterExpressionChanged()
An additional filter expression to apply, next to the filterValue.
void setFetchLimit(int fetchLimit)
Defines the feature request fetch limit If set to 0, no limit is applied when fetching.
int columnCount(const QModelIndex &parent) const override
QVariant extraIdentifierValue() const
Allows specifying one value that does not need to match the filter criteria but will still be availab...
void extraValueDoesNotExistChanged(bool found)
Notification whether the model has found a feature tied to the extraIdentifierValue or not.
virtual QgsFeatureExpressionValuesGatherer * createValuesGatherer(const QgsFeatureRequest &request) const =0
Creates the value gatherer.
void setSortOrder(const Qt::SortOrder sortOrder)
The order direction will be used for sort values in the combobox.
void setFetchGeometry(bool fetchGeometry)
Defines if the geometry will be fetched.
void setExtraIdentifierValueUnguarded(const QVariant &identifierValue)
This will set the identifier value to be set in the model even if it doesn't exist currently in the d...
void extraIdentifierValueChanged()
Allows specifying one value that does not need to match the filter criteria but will still be availab...
void setOrderExpression(const QString &orderExpression)
The order expression will be used for sort values in the combobox.
virtual QSet< QString > requestedAttributes() const
Returns the attributes to be fetched in the request.
int mExtraValueIndex
The current index.
CustomRole
Extra roles that can be used to fetch data from this model.
QModelIndex parent(const QModelIndex &child) const override
void filterJobCompleted()
Indicates that a filter job has been completed and new data may be available.
void setAllowNull(bool allowNull)
Add a NULL entry to the list.
void setDisplayExpression(const QString &displayExpression)
The display expression will be used for.
QVariant mExtraIdentifierValue
The current identifier value.
friend class TestQgsFeatureListComboBox
QgsFeaturePickerModelBase(QObject *parent=nullptr)
Create a new QgsFeaturePickerModelBase, optionally specifying a parent.
virtual QgsFeatureExpressionValuesGatherer::Entry createEntry(const QVariant &identifier) const =0
Creates an entry with just the identifier so the feature can be retrieved in a next iteration.
virtual bool identifierIsNull(const QVariant &identifier) const =0
Returns true if the entry is null The identifier can be either the feature ID or the list of identifi...
QgsVectorLayer * sourceLayer
QModelIndex index(int row, int column, const QModelIndex &parent) const override
int extraIdentifierValueIndex
void fetchLimitChanged()
Emitted when the fetching limit for the feature request changes.
void sourceLayerChanged()
The source layer from which features will be fetched.
void setFilterExpression(const QString &filterExpression)
An additional filter expression to apply, next to the filterValue.
void allowNullChanged()
Add a NULL entry to the list.
virtual bool compareEntries(const QgsFeatureExpressionValuesGatherer::Entry &a, const QgsFeatureExpressionValuesGatherer::Entry &b) const =0
Returns true if the 2 entries refers to the same feature.
void currentFeatureChanged()
Emitted when the current feature in the model has changed This emitted both when the extra value chan...
void orderExpressionChanged()
An expression for generating values for sorting.
void fetchGeometryChanged()
Emitted when the fetching of the geometry changes.
void sortOrderChanged()
The direction used for sorting.
void isLoadingChanged()
Indicator if the model is currently performing any feature iteration in the background.
void formFeatureChanged()
An attribute form feature to be used alongside the filter expression.
QString displayExpression
QVector< QgsFeatureExpressionValuesGatherer::Entry > mEntries
virtual QVariant nullIdentifier() const =0
Returns a null identifier.
void endUpdate()
Notification that the model change is finished.
void displayExpressionChanged()
The display expression will be used for.
void setSourceLayer(QgsVectorLayer *sourceLayer)
The source layer from which features will be fetched.
bool extraValueDoesNotExist() const
Flag indicating that the extraIdentifierValue does not exist in the data.
Wraps a request for features to a vector layer (or directly its vector data provider).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Represents a vector layer which manages a vector based dataset.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
#define SIP_MONKEYPATCH_COMPAT_NAME(FORMERNAME)