QGIS API Documentation  3.11.0-Master (68611307d7)
Classes | Public Types | Signals | Public Member Functions | Properties | Friends | 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]

Public Types

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

Signals

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 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 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 identifierFieldChanged ()
 The identifier field should be a unique field that can be used to identify individual features. 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...
 
 ~QgsFeatureFilterModel () 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...
 
Q_DECL_DEPRECATED 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...
 
int extraIdentifierValueIndex () const
 The index at which the extra identifier value is available within the model. 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...
 
bool extraValueDoesNotExist () const
 Flag indicating that the extraIdentifierValue does not exist in the data. 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...
 
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...
 
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...
 
Q_DECL_DEPRECATED 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 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 setExtraIdentifierValuesToNull ()
 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 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...
 
Q_DECL_DEPRECATED void setIdentifierField (const QString &identifierField)
 The identifier field should be a unique field that can be used to identify individual features. More...
 
void setIdentifierFields (const QStringList &identifierFields)
 The identifier field should be a unique field that can be used to identify individual features. 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

bool allowNull
 
QString displayExpression
 
QVariant extraIdentifierValue
 The value that identifies the current feature. More...
 
int extraIdentifierValueIndex
 
QString filterExpression
 
QString filterValue
 
QString identifierField
 A field of sourceLayer that is unique and should be used to identify features. More...
 
bool isLoading
 
QgsVectorLayer sourceLayer
 

Friends

class QgsFieldExpressionValuesGatherer
 

Detailed Description

Provides a list of features based on filter conditions.

Features are fetched asynchronously.

Since
QGIS 3.0

Definition at line 31 of file qgsfeaturefiltermodel.h.

Member Enumeration Documentation

◆ Role

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

Enumerator
IdentifierValueRole 
Deprecated:
Use IdentifierValuesRole instead
IdentifierValuesRole 

Used to retrieve the identifierValues (primary keys) of a feature.

ValueRole 

Used to retrieve the displayExpression of a feature.

Definition at line 61 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 37 of file qgsfeaturefiltermodel.cpp.

◆ ~QgsFeatureFilterModel()

QgsFeatureFilterModel::~QgsFeatureFilterModel ( )
override

Definition at line 46 of file qgsfeaturefiltermodel.cpp.

Member Function Documentation

◆ allowNull()

bool QgsFeatureFilterModel::allowNull ( ) const

Add a NULL entry to the list.

◆ allowNullChanged

void QgsFeatureFilterModel::allowNullChanged ( )
signal

Add a NULL entry to the list.

◆ beginUpdate

void QgsFeatureFilterModel::beginUpdate ( )
signal

Notification that the model is about to be changed because a job was completed.

◆ columnCount()

int QgsFeatureFilterModel::columnCount ( const QModelIndex &  parent) const
override

Definition at line 142 of file qgsfeaturefiltermodel.cpp.

◆ data()

QVariant QgsFeatureFilterModel::data ( const QModelIndex &  index,
int  role 
) const
override

Definition at line 148 of file qgsfeaturefiltermodel.cpp.

◆ displayExpression()

QString QgsFeatureFilterModel::displayExpression ( ) const

The display expression will be used for.

  • displaying values in the combobox
  • filtering based on filterValue

◆ displayExpressionChanged

void QgsFeatureFilterModel::displayExpressionChanged ( )
signal

The display expression will be used for.

  • displaying values in the combobox
  • filtering based on filterValue

◆ endUpdate

void QgsFeatureFilterModel::endUpdate ( )
signal

Notification that the model change is finished.

Will always be emitted in sync with beginUpdate.

◆ extraIdentifierValue()

Q_DECL_DEPRECATED QVariant QgsFeatureFilterModel::extraIdentifierValue ( ) const

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

Deprecated:
since QGIS 3.10

◆ extraIdentifierValueChanged

void QgsFeatureFilterModel::extraIdentifierValueChanged ( )
signal

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

◆ extraIdentifierValueIndex()

int QgsFeatureFilterModel::extraIdentifierValueIndex ( ) const

The index at which the extra identifier value is available within the model.

◆ extraIdentifierValueIndexChanged

void QgsFeatureFilterModel::extraIdentifierValueIndexChanged ( int  index)
signal

The index at which the extra identifier value is available within the model.

◆ 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 600 of file qgsfeaturefiltermodel.cpp.

◆ extraValueDoesNotExist()

bool QgsFeatureFilterModel::extraValueDoesNotExist ( ) const

Flag indicating that the extraIdentifierValue does not exist in the data.

Definition at line 548 of file qgsfeaturefiltermodel.cpp.

◆ extraValueDoesNotExistChanged

void QgsFeatureFilterModel::extraValueDoesNotExistChanged ( )
signal

Flag indicating that the extraIdentifierValue does not exist in the data.

◆ filterExpression()

QString QgsFeatureFilterModel::filterExpression ( ) const

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

Can be used for spatial filtering etc.

◆ filterExpressionChanged

void QgsFeatureFilterModel::filterExpressionChanged ( )
signal

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

Can be used for spatial filtering etc.

◆ filterJobCompleted

void QgsFeatureFilterModel::filterJobCompleted ( )
signal

Indicates that a filter job has been completed and new data may be available.

◆ filterValue()

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.

◆ filterValueChanged

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.

◆ identifierField()

Q_DECL_DEPRECATED 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

◆ identifierFieldChanged

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.

◆ 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 567 of file qgsfeaturefiltermodel.cpp.

◆ index()

QModelIndex QgsFeatureFilterModel::index ( int  row,
int  column,
const QModelIndex &  parent 
) const
override

Definition at line 123 of file qgsfeaturefiltermodel.cpp.

◆ isLoading()

bool QgsFeatureFilterModel::isLoading ( ) const

Indicator if the model is currently performing any feature iteration in the background.

◆ isLoadingChanged

void QgsFeatureFilterModel::isLoadingChanged ( )
signal

Indicator if the model is currently performing any feature iteration in the background.

◆ parent()

QModelIndex QgsFeatureFilterModel::parent ( const QModelIndex &  child) const
override

Definition at line 129 of file qgsfeaturefiltermodel.cpp.

◆ rowCount()

int QgsFeatureFilterModel::rowCount ( const QModelIndex &  parent) const
override

Definition at line 135 of file qgsfeaturefiltermodel.cpp.

◆ setAllowNull()

void QgsFeatureFilterModel::setAllowNull ( bool  allowNull)

Add a NULL entry to the list.

Definition at line 537 of file qgsfeaturefiltermodel.cpp.

◆ setDisplayExpression()

void QgsFeatureFilterModel::setDisplayExpression ( const QString &  displayExpression)

The display expression will be used for.

  • displaying values in the combobox
  • filtering based on filterValue

Definition at line 73 of file qgsfeaturefiltermodel.cpp.

◆ setExtraIdentifierValue()

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

Deprecated:
since QGIS 3.10

Definition at line 612 of file qgsfeaturefiltermodel.cpp.

◆ 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 620 of file qgsfeaturefiltermodel.cpp.

◆ setExtraIdentifierValuesToNull()

void QgsFeatureFilterModel::setExtraIdentifierValuesToNull ( )

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

Definition at line 639 of file qgsfeaturefiltermodel.cpp.

◆ setFilterExpression()

void QgsFeatureFilterModel::setFilterExpression ( const QString &  filterExpression)

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

Can be used for spatial filtering etc.

Definition at line 103 of file qgsfeaturefiltermodel.cpp.

◆ setFilterValue()

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.

Definition at line 88 of file qgsfeaturefiltermodel.cpp.

◆ setIdentifierField()

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.

Deprecated:
since QGIS 3.10

Definition at line 572 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 577 of file qgsfeaturefiltermodel.cpp.

◆ setSourceLayer()

void QgsFeatureFilterModel::setSourceLayer ( QgsVectorLayer sourceLayer)

The source layer from which features will be fetched.

Definition at line 57 of file qgsfeaturefiltermodel.cpp.

◆ sourceLayer()

QgsVectorLayer* QgsFeatureFilterModel::sourceLayer ( ) const

The source layer from which features will be fetched.

◆ sourceLayerChanged

void QgsFeatureFilterModel::sourceLayerChanged ( )
signal

The source layer from which features will be fetched.

Friends And Related Function Documentation

◆ QgsFieldExpressionValuesGatherer

friend class QgsFieldExpressionValuesGatherer
friend

Definition at line 349 of file qgsfeaturefiltermodel.h.

Property Documentation

◆ allowNull

bool QgsFeatureFilterModel::allowNull
readwrite

Definition at line 39 of file qgsfeaturefiltermodel.h.

◆ displayExpression

QString QgsFeatureFilterModel::displayExpression
readwrite

Definition at line 36 of file qgsfeaturefiltermodel.h.

◆ extraIdentifierValue

QVariant QgsFeatureFilterModel::extraIdentifierValue
readwrite

The value that identifies the current feature.

Definition at line 52 of file qgsfeaturefiltermodel.h.

◆ extraIdentifierValueIndex

int QgsFeatureFilterModel::extraIdentifierValueIndex
read

Definition at line 54 of file qgsfeaturefiltermodel.h.

◆ filterExpression

QString QgsFeatureFilterModel::filterExpression
readwrite

Definition at line 38 of file qgsfeaturefiltermodel.h.

◆ filterValue

QString QgsFeatureFilterModel::filterValue
readwrite

Definition at line 37 of file qgsfeaturefiltermodel.h.

◆ identifierField

QString QgsFeatureFilterModel::identifierField
readwrite

A field 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 47 of file qgsfeaturefiltermodel.h.

◆ isLoading

bool QgsFeatureFilterModel::isLoading
read

Definition at line 40 of file qgsfeaturefiltermodel.h.

◆ sourceLayer

QgsVectorLayer * QgsFeatureFilterModel::sourceLayer
readwrite

Definition at line 35 of file qgsfeaturefiltermodel.h.


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