QgsFeatureFilterModel class

Provides a list of features based on filter conditions.

Features are fetched asynchronously.

Public types

enum Role { IdentifierValueRole = Qt::UserRole, ValueRole }
Extra roles that can be used to fetch data from this model.

Constructors, destructors, conversion operators

QgsFeatureFilterModel(QObject* parent = nullptr) explicit
Create a new QgsFeatureFilterModel, optionally specifying a parent.

Public functions

auto allowNull() const -> bool
Add a NULL entry to the list.
auto displayExpression() const -> QString
The display expression will be used for.
auto extraIdentifierValue() const -> QVariant
Allows specifying one value that does not need to match the filter criteria but will still be available in the model.
auto extraIdentifierValueIndex() const -> int
The index at which the extra identifier value is available within the model.
auto extraValueDoesNotExist() const -> bool
Flag indicating that the extraIdentifierValue does not exist in the data.
auto filterExpression() const -> QString
An additional filter expression to apply, next to the filterValue.
auto filterValue() const -> QString
This value will be used to filter the features available from this model.
auto identifierField() const -> QString
The identifier field should be a unique field that can be used to identify individual features.
auto isLoading() const -> bool
Indicator if the model is currently performing any feature iteration in the background.
void setAllowNull(bool allowNull)
Add a NULL entry to the list.
void setDisplayExpression(const QString& displayExpression)
The display expression will be used for.
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.
void setFilterExpression(const QString& filterExpression)
An additional filter expression to apply, next to the filterValue.
void setFilterValue(const QString& filterValue)
This value will be used to filter the features available from this model.
void setIdentifierField(const QString& identifierField)
The identifier field should be a unique field that can be used to identify individual features.
void setSourceLayer(QgsVectorLayer* sourceLayer)
The source layer from which features will be fetched.
auto sourceLayer() const -> QgsVectorLayer*
The source layer from which features will be fetched.

Signals

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

Enum documentation

enum QgsFeatureFilterModel::Role

Extra roles that can be used to fetch data from this model.

Enumerators
IdentifierValueRole

Used to retrieve the identifierValue (primary key) of a feature.

ValueRole

Used to retrieve the displayExpression of a feature.

Function documentation

QString QgsFeatureFilterModel::displayExpression() const

The display expression will be used for.

  • displaying values in the combobox
  • filtering based on filterValue

QString QgsFeatureFilterModel::filterExpression() const

An additional filter expression to apply, next to the filterValue.

Can be used for spatial filtering etc.

QString QgsFeatureFilterModel::filterValue() const

This value will be used to filter the features available from this model.

Whenever a substring of the displayExpression of a feature matches the filter value, it will be accessible by this model.

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.

void QgsFeatureFilterModel::setDisplayExpression(const QString& displayExpression)

The display expression will be used for.

  • displaying values in the combobox
  • filtering based on filterValue

void QgsFeatureFilterModel::setFilterExpression(const QString& filterExpression)

An additional filter expression to apply, next to the filterValue.

Can be used for spatial filtering etc.

void QgsFeatureFilterModel::setFilterValue(const QString& filterValue)

This value will be used to filter the features available from this model.

Whenever a substring of the displayExpression of a feature matches the filter value, it will be accessible by this model.

void QgsFeatureFilterModel::setIdentifierField(const QString& identifierField)

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.

void QgsFeatureFilterModel::displayExpressionChanged() signal

The display expression will be used for.

  • displaying values in the combobox
  • filtering based on filterValue

void QgsFeatureFilterModel::endUpdate() signal

Notification that the model change is finished.

Will always be emitted in sync with beginUpdate.

void QgsFeatureFilterModel::filterExpressionChanged() signal

An additional filter expression to apply, next to the filterValue.

Can be used for spatial filtering etc.

void QgsFeatureFilterModel::filterValueChanged() signal

This value will be used to filter the features available from this model.

Whenever a substring of the displayExpression of a feature matches the filter value, it will be accessible by this model.

void QgsFeatureFilterModel::identifierFieldChanged() 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.