QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Signals | Public Member Functions | Properties | List of all members
QgsFeatureFilterModel Class Reference

Provides a list of features based on filter conditions. More...

#include <qgsfeaturefiltermodel.h>

Inheritance diagram for QgsFeatureFilterModel:
Inheritance graph
[legend]

Signals

void extraIdentifierValuesChanged ()
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model. More...
 
void identifierFieldsChanged ()
 The identifier field should be a unique field that can be used to identify individual features. More...
 
- Signals inherited from QgsFeaturePickerModelBase
void allowNullChanged ()
 Add a NULL entry to the list. More...
 
void beginUpdate ()
 Notification that the model is about to be changed because a job was completed. More...
 
void currentFeatureChanged ()
 Emitted when the current feature in the model has changed This emitted both when the extra value changes and when the extra value status changes. More...
 
void displayExpressionChanged ()
 The display expression will be used for. More...
 
void endUpdate ()
 Notification that the model change is finished. More...
 
void extraIdentifierValueChanged ()
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model. More...
 
void extraIdentifierValueIndexChanged (int index)
 The index at which the extra identifier value is available within the model. More...
 
void extraValueDoesNotExistChanged ()
 Flag indicating that the extraIdentifierValue does not exist in the data. More...
 
void fetchGeometryChanged ()
 Emitted when the fetching of the geometry changes. More...
 
void fetchLimitChanged ()
 Emitted when the fetching limit for the feature request changes. More...
 
void filterExpressionChanged ()
 An additional filter expression to apply, next to the filterValue. More...
 
void filterJobCompleted ()
 Indicates that a filter job has been completed and new data may be available. More...
 
void filterValueChanged ()
 This value will be used to filter the features available from this model. More...
 
void isLoadingChanged ()
 Indicator if the model is currently performing any feature iteration in the background. More...
 
void sourceLayerChanged ()
 The source layer from which features will be fetched. More...
 

Public Member Functions

 QgsFeatureFilterModel (QObject *parent=nullptr)
 Create a new QgsFeatureFilterModel, optionally specifying a parent. More...
 
QVariantList extraIdentifierValues () const
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model. More...
 
Q_DECL_DEPRECATED QString identifierField () const
 The identifier field should be a unique field that can be used to identify individual features. More...
 
QStringList identifierFields () const
 The identifier field should be a unique field that can be used to identify individual features. More...
 
void setExtraIdentifierValues (const QVariantList &extraIdentifierValues)
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model. More...
 
void setExtraIdentifierValueToNull () override
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model as NULL value(s). More...
 
void setIdentifierFields (const QStringList &identifierFields)
 The identifier field should be a unique field that can be used to identify individual features. More...
 
- Public Member Functions inherited from QgsFeaturePickerModelBase
 QgsFeaturePickerModelBase (QObject *parent=nullptr)
 Create a new QgsFeaturePickerModelBase, optionally specifying a parent. More...
 
 ~QgsFeaturePickerModelBase () override
 
bool allowNull () const
 Add a NULL entry to the list. More...
 
int columnCount (const QModelIndex &parent) const override
 
QVariant data (const QModelIndex &index, int role) const override
 
QString displayExpression () const
 The display expression will be used for. More...
 
int extraIdentifierValueIndex () const
 The index at which the extra identifier value is available within the model. More...
 
bool extraValueDoesNotExist () const
 Flag indicating that the extraIdentifierValue does not exist in the data. More...
 
bool fetchGeometry () const
 Returns if the geometry is fetched. More...
 
int fetchLimit () const
 Returns the feature request fetch limit. More...
 
QString filterExpression () const
 An additional filter expression to apply, next to the filterValue. More...
 
QString filterValue () const
 This value will be used to filter the features available from this model. More...
 
QModelIndex index (int row, int column, const QModelIndex &parent) const override
 
bool isLoading () const
 Indicator if the model is currently performing any feature iteration in the background. More...
 
QModelIndex parent (const QModelIndex &child) const override
 
int rowCount (const QModelIndex &parent) const override
 
void setAllowNull (bool allowNull)
 Add a NULL entry to the list. More...
 
void setDisplayExpression (const QString &displayExpression)
 The display expression will be used for. More...
 
virtual void setExtraIdentifierValueToNull ()=0
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model as NULL value(s). More...
 
void setFetchGeometry (bool fetchGeometry)
 Defines if the geometry will be fetched. More...
 
void setFetchLimit (int fetchLimit)
 Defines the feature request fetch limit If set to 0, no limit is applied when fetching. More...
 
void setFilterExpression (const QString &filterExpression)
 An additional filter expression to apply, next to the filterValue. More...
 
void setFilterValue (const QString &filterValue)
 This value will be used to filter the features available from this model. More...
 
void setSourceLayer (QgsVectorLayer *sourceLayer)
 The source layer from which features will be fetched. More...
 
QgsVectorLayersourceLayer () const
 The source layer from which features will be fetched. More...
 

Properties

QVariantList extraIdentifierValues
 The values that identifies the current feature. More...
 
QStringList identifierFields
 A set of fields of sourceLayer that is unique and should be used to identify features. More...
 
- Properties inherited from QgsFeaturePickerModelBase
bool allowNull
 
QString displayExpression
 
int extraIdentifierValueIndex
 
bool fetchGeometry
 
int fetchLimit
 
QString filterExpression
 
QString filterValue
 
QgsVectorLayersourceLayer
 

Additional Inherited Members

- Public Types inherited from QgsFeaturePickerModelBase
enum class  CustomRole : int {
  IdentifierValue = Qt::UserRole , IdentifierValues , Value , Feature ,
  FeatureId
}
 Extra roles that can be used to fetch data from this model. More...
 
- Protected Member Functions inherited from QgsFeaturePickerModelBase
virtual bool compareEntries (const QgsFeatureExpressionValuesGatherer::Entry &a, const QgsFeatureExpressionValuesGatherer::Entry &b) const =0
 Returns true if the 2 entries refers to the same feature. More...
 
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. More...
 
virtual QgsFeatureExpressionValuesGatherer * createValuesGatherer (const QgsFeatureRequest &request) const =0
 Creates the value gatherer. More...
 
virtual QVariant entryIdentifier (const QgsFeatureExpressionValuesGatherer::Entry &entry) const =0
 Returns the identifier of the given entry. More...
 
QVariant extraIdentifierValue () const
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model. More...
 
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 identifier fields. More...
 
virtual QVariant nullIdentifier () const =0
 Returns a null identifier. More...
 
virtual QSet< QString > requestedAttributes () const
 Returns the attributes to be fetched in the request. More...
 
virtual void requestToReloadCurrentFeature (QgsFeatureRequest &request)=0
 Update the request to match the current feature to be reloaded. More...
 
void setExtraIdentifierValue (const QVariant &extraIdentifierValue)
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model. More...
 
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 data. More...
 
- Protected Attributes inherited from QgsFeaturePickerModelBase
QVector< QgsFeatureExpressionValuesGatherer::Entry > mEntries
 
QVariant mExtraIdentifierValue
 The current identifier value. More...
 
int mExtraValueIndex = -1
 The current index. More...
 

Detailed Description

Provides a list of features based on filter conditions.

Features are fetched asynchronously.

Definition at line 27 of file qgsfeaturefiltermodel.h.

Constructor & Destructor Documentation

◆ QgsFeatureFilterModel()

QgsFeatureFilterModel::QgsFeatureFilterModel ( QObject *  parent = nullptr)
explicit

Create a new QgsFeatureFilterModel, optionally specifying a parent.

Definition at line 36 of file qgsfeaturefiltermodel.cpp.

Member Function Documentation

◆ extraIdentifierValues()

QVariantList QgsFeatureFilterModel::extraIdentifierValues ( ) const

Allows specifying one value that does not need to match the filter criteria but will still be available in the model.

Since
QGIS 3.10

Definition at line 135 of file qgsfeaturefiltermodel.cpp.

◆ extraIdentifierValuesChanged

void QgsFeatureFilterModel::extraIdentifierValuesChanged ( )
signal

Allows specifying one value that does not need to match the filter criteria but will still be available in the model.

◆ identifierField()

QString QgsFeatureFilterModel::identifierField ( ) const

The identifier field should be a unique field that can be used to identify individual features.

It is normally set to the primary key of the layer. If there are several identifier fields defined, the behavior is not guaranteed

Deprecated:
since QGIS 3.10 use identifierFields instead

Definition at line 44 of file qgsfeaturefiltermodel.cpp.

◆ identifierFields()

QStringList QgsFeatureFilterModel::identifierFields ( ) const

The identifier field should be a unique field that can be used to identify individual features.

It is normally set to the primary key of the layer.

Since
QGIS 3.10

Definition at line 113 of file qgsfeaturefiltermodel.cpp.

◆ identifierFieldsChanged

void QgsFeatureFilterModel::identifierFieldsChanged ( )
signal

The identifier field should be a unique field that can be used to identify individual features.

It is normally set to the primary key of the layer.

◆ setExtraIdentifierValues()

void QgsFeatureFilterModel::setExtraIdentifierValues ( const QVariantList &  extraIdentifierValues)

Allows specifying one value that does not need to match the filter criteria but will still be available in the model.

Since
QGIS 3.10

Definition at line 145 of file qgsfeaturefiltermodel.cpp.

◆ setExtraIdentifierValueToNull()

void QgsFeatureFilterModel::setExtraIdentifierValueToNull ( )
overridevirtual

Allows specifying one value that does not need to match the filter criteria but will still be available in the model as NULL value(s).

Since
QGIS 3.10

Implements QgsFeaturePickerModelBase.

Definition at line 150 of file qgsfeaturefiltermodel.cpp.

◆ setIdentifierFields()

void QgsFeatureFilterModel::setIdentifierFields ( const QStringList &  identifierFields)

The identifier field should be a unique field that can be used to identify individual features.

It is normally set to the primary key of the layer.

Note
This will also reset identifier fields to NULL
Since
QGIS 3.10

Definition at line 119 of file qgsfeaturefiltermodel.cpp.

Property Documentation

◆ extraIdentifierValues

QVariantList QgsFeatureFilterModel::extraIdentifierValues
readwrite

The values that identifies the current feature.

Definition at line 27 of file qgsfeaturefiltermodel.h.

◆ identifierFields

QStringList QgsFeatureFilterModel::identifierFields
readwrite

A set of fields of sourceLayer that is unique and should be used to identify features.

Normally the primary key field. Needs to match the identifierValue.

Definition at line 27 of file qgsfeaturefiltermodel.h.


The documentation for this class was generated from the following files: