QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Types | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Friends | List of all members
QgsFeaturePickerModelBase Class Referenceabstract

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

#include <qgsfeaturepickermodelbase.h>

Inheritance diagram for QgsFeaturePickerModelBase:
Inheritance graph
[legend]

Public Types

enum class  CustomRole : int {
  IdentifierValue = Qt::UserRole , IdentifierValues , Value , Feature ,
  FeatureId
}
 Extra roles that can be used to fetch data from this model. More...
 

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 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.
 
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 (bool found)
 Notification whether the model has found a feature tied to the extraIdentifierValue or not.
 
void fetchGeometryChanged ()
 Emitted when the fetching of the geometry changes.
 
void fetchLimitChanged ()
 Emitted when the fetching limit for the feature request changes.
 
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 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.
 

Public Member Functions

 QgsFeaturePickerModelBase (QObject *parent=nullptr)
 Create a new QgsFeaturePickerModelBase, optionally specifying a parent.
 
 ~QgsFeaturePickerModelBase () override
 
bool allowNull () const
 Add a NULL entry to the list.
 
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.
 
int extraIdentifierValueIndex () const
 The index at which the extra identifier value is available within the model.
 
bool extraValueDoesNotExist () const
 Flag indicating that the extraIdentifierValue does not exist in the data.
 
bool fetchGeometry () const
 Returns if the geometry is fetched.
 
int fetchLimit () const
 Returns the feature request fetch limit.
 
QString filterExpression () const
 An additional filter expression to apply, next to the filterValue.
 
QString filterValue () const
 This value will be used to filter the features available from this model.
 
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.
 
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.
 
void setDisplayExpression (const QString &displayExpression)
 The display expression will be used for.
 
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).
 
void setFetchGeometry (bool fetchGeometry)
 Defines if the geometry will be fetched.
 
void setFetchLimit (int fetchLimit)
 Defines the feature request fetch limit If set to 0, no limit is applied when fetching.
 
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 setSourceLayer (QgsVectorLayer *sourceLayer)
 The source layer from which features will be fetched.
 
QgsVectorLayersourceLayer () const
 The source layer from which features will be fetched.
 

Protected Member Functions

virtual bool compareEntries (const QgsFeatureExpressionValuesGatherer::Entry &a, const QgsFeatureExpressionValuesGatherer::Entry &b) const =0
 Returns true if the 2 entries refers to the same feature.
 
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 QgsFeatureExpressionValuesGatherer * createValuesGatherer (const QgsFeatureRequest &request) const =0
 Creates the value gatherer.
 
virtual QVariant entryIdentifier (const QgsFeatureExpressionValuesGatherer::Entry &entry) const =0
 Returns the identifier of the given entry.
 
QVariant extraIdentifierValue () const
 Allows specifying one value that does not need to match the filter criteria but will still be available in the model.
 
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.
 
virtual QVariant nullIdentifier () const =0
 Returns a null identifier.
 
virtual QSet< QString > requestedAttributes () const
 Returns the attributes to be fetched in the request.
 
virtual void requestToReloadCurrentFeature (QgsFeatureRequest &request)=0
 Update the request to match the current feature to be reloaded.
 
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 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.
 

Protected Attributes

QVector< QgsFeatureExpressionValuesGatherer::Entry > mEntries
 
QVariant mExtraIdentifierValue
 The current identifier value.
 
int mExtraValueIndex = -1
 The current index.
 

Properties

bool allowNull
 
QString displayExpression
 
int extraIdentifierValueIndex
 
bool fetchGeometry
 
int fetchLimit
 
QString filterExpression
 
QString filterValue
 
QgsVectorLayersourceLayer
 

Friends

class TestQgsFeatureListComboBox
 

Detailed Description

Provides a list of features based on filter conditions.

Features are fetched asynchronously.

Since
QGIS 3.14

Definition at line 32 of file qgsfeaturepickermodelbase.h.

Member Enumeration Documentation

◆ CustomRole

enum class QgsFeaturePickerModelBase::CustomRole : int
strong

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

Note
Prior to QGIS 3.36 this was available as QgsFeaturePickerModelBase::Role
Since
QGIS 3.36
Enumerator
IdentifierValue 

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

Deprecated:
QGIS 3.40. Use IdentifierValuesRole instead.
IdentifierValues 

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

Value 

Used to retrieve the displayExpression of a feature.

Feature 

Used to retrieve the feature, it might be incomplete if the request doesn't fetch all attributes or geometry.

FeatureId 

Used to retrieve the id of a feature.

Definition at line 55 of file qgsfeaturepickermodelbase.h.

Constructor & Destructor Documentation

◆ QgsFeaturePickerModelBase()

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

Create a new QgsFeaturePickerModelBase, optionally specifying a parent.

Definition at line 24 of file qgsfeaturepickermodelbase.cpp.

◆ ~QgsFeaturePickerModelBase()

QgsFeaturePickerModelBase::~QgsFeaturePickerModelBase ( )
override

Definition at line 37 of file qgsfeaturepickermodelbase.cpp.

Member Function Documentation

◆ allowNull()

bool QgsFeaturePickerModelBase::allowNull ( ) const

Add a NULL entry to the list.

Definition at line 550 of file qgsfeaturepickermodelbase.cpp.

◆ allowNullChanged

void QgsFeaturePickerModelBase::allowNullChanged ( )
signal

Add a NULL entry to the list.

◆ beginUpdate

void QgsFeaturePickerModelBase::beginUpdate ( )
signal

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

◆ columnCount()

int QgsFeaturePickerModelBase::columnCount ( const QModelIndex &  parent) const
inlineoverride

Definition at line 115 of file qgsfeaturepickermodelbase.h.

◆ compareEntries()

virtual bool QgsFeaturePickerModelBase::compareEntries ( const QgsFeatureExpressionValuesGatherer::Entry &  a,
const QgsFeatureExpressionValuesGatherer::Entry &  b 
) const
protectedpure virtual

Returns true if the 2 entries refers to the same feature.

◆ createEntry()

virtual QgsFeatureExpressionValuesGatherer::Entry QgsFeaturePickerModelBase::createEntry ( const QVariant &  identifier) const
protectedpure virtual

Creates an entry with just the identifier so the feature can be retrieved in a next iteration.

◆ createValuesGatherer()

virtual QgsFeatureExpressionValuesGatherer * QgsFeaturePickerModelBase::createValuesGatherer ( const QgsFeatureRequest request) const
protectedpure virtual

Creates the value gatherer.

◆ currentFeatureChanged

void QgsFeaturePickerModelBase::currentFeatureChanged ( )
signal

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.

It allows being notified when the feature is fetched after the extra value has been set.

Since
QGIS 3.16.5

◆ data()

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

Definition at line 151 of file qgsfeaturepickermodelbase.cpp.

◆ displayExpression()

QString QgsFeaturePickerModelBase::displayExpression ( ) const

The display expression will be used for.

  • displaying values in the combobox
  • filtering based on filterValue

Definition at line 67 of file qgsfeaturepickermodelbase.cpp.

◆ displayExpressionChanged

void QgsFeaturePickerModelBase::displayExpressionChanged ( )
signal

The display expression will be used for.

  • displaying values in the combobox
  • filtering based on filterValue

◆ endUpdate

void QgsFeaturePickerModelBase::endUpdate ( )
signal

Notification that the model change is finished.

Will always be emitted in sync with beginUpdate.

◆ entryIdentifier()

virtual QVariant QgsFeaturePickerModelBase::entryIdentifier ( const QgsFeatureExpressionValuesGatherer::Entry &  entry) const
protectedpure virtual

Returns the identifier of the given entry.

◆ extraIdentifierValue()

QVariant QgsFeaturePickerModelBase::extraIdentifierValue ( ) const
protected

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

Definition at line 123 of file qgsfeaturepickermodelbase.cpp.

◆ extraIdentifierValueChanged

void QgsFeaturePickerModelBase::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 QgsFeaturePickerModelBase::extraIdentifierValueIndex ( ) const

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

Definition at line 614 of file qgsfeaturepickermodelbase.cpp.

◆ extraIdentifierValueIndexChanged

void QgsFeaturePickerModelBase::extraIdentifierValueIndexChanged ( int  index)
signal

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

◆ extraValueDoesNotExist()

bool QgsFeaturePickerModelBase::extraValueDoesNotExist ( ) const

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

Definition at line 598 of file qgsfeaturepickermodelbase.cpp.

◆ extraValueDoesNotExistChanged

void QgsFeaturePickerModelBase::extraValueDoesNotExistChanged ( bool  found)
signal

Notification whether the model has found a feature tied to the extraIdentifierValue or not.

◆ fetchGeometry()

bool QgsFeaturePickerModelBase::fetchGeometry ( ) const

Returns if the geometry is fetched.

Definition at line 567 of file qgsfeaturepickermodelbase.cpp.

◆ fetchGeometryChanged

void QgsFeaturePickerModelBase::fetchGeometryChanged ( )
signal

Emitted when the fetching of the geometry changes.

◆ fetchLimit()

int QgsFeaturePickerModelBase::fetchLimit ( ) const

Returns the feature request fetch limit.

Definition at line 581 of file qgsfeaturepickermodelbase.cpp.

◆ fetchLimitChanged

void QgsFeaturePickerModelBase::fetchLimitChanged ( )
signal

Emitted when the fetching limit for the feature request changes.

◆ filterExpression()

QString QgsFeaturePickerModelBase::filterExpression ( ) const

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

Can be used for spatial filtering etc.

Definition at line 101 of file qgsfeaturepickermodelbase.cpp.

◆ filterExpressionChanged

void QgsFeaturePickerModelBase::filterExpressionChanged ( )
signal

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

Can be used for spatial filtering etc.

◆ filterJobCompleted

void QgsFeaturePickerModelBase::filterJobCompleted ( )
signal

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

◆ filterValue()

QString QgsFeaturePickerModelBase::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.

Definition at line 84 of file qgsfeaturepickermodelbase.cpp.

◆ filterValueChanged

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

◆ identifierIsNull()

virtual bool QgsFeaturePickerModelBase::identifierIsNull ( const QVariant &  identifier) const
protectedpure virtual

Returns true if the entry is null The identifier can be either the feature ID or the list of identifier fields.

◆ index()

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

Definition at line 129 of file qgsfeaturepickermodelbase.cpp.

◆ isLoading()

bool QgsFeaturePickerModelBase::isLoading ( ) const

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

Definition at line 118 of file qgsfeaturepickermodelbase.cpp.

◆ isLoadingChanged

void QgsFeaturePickerModelBase::isLoadingChanged ( )
signal

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

◆ nullIdentifier()

virtual QVariant QgsFeaturePickerModelBase::nullIdentifier ( ) const
protectedpure virtual

Returns a null identifier.

◆ parent()

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

Definition at line 136 of file qgsfeaturepickermodelbase.cpp.

◆ requestedAttributes()

virtual QSet< QString > QgsFeaturePickerModelBase::requestedAttributes ( ) const
inlineprotectedvirtual

Returns the attributes to be fetched in the request.

Returns an empty set if all attributes should be fetched.

Definition at line 304 of file qgsfeaturepickermodelbase.h.

◆ requestToReloadCurrentFeature()

virtual void QgsFeaturePickerModelBase::requestToReloadCurrentFeature ( QgsFeatureRequest request)
protectedpure virtual

Update the request to match the current feature to be reloaded.

◆ rowCount()

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

Definition at line 143 of file qgsfeaturepickermodelbase.cpp.

◆ setAllowNull()

void QgsFeaturePickerModelBase::setAllowNull ( bool  allowNull)

Add a NULL entry to the list.

Definition at line 556 of file qgsfeaturepickermodelbase.cpp.

◆ setDisplayExpression()

void QgsFeaturePickerModelBase::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 qgsfeaturepickermodelbase.cpp.

◆ setExtraIdentifierValue()

void QgsFeaturePickerModelBase::setExtraIdentifierValue ( const QVariant &  extraIdentifierValue)
protected

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

Definition at line 626 of file qgsfeaturepickermodelbase.cpp.

◆ setExtraIdentifierValueToNull()

virtual void QgsFeaturePickerModelBase::setExtraIdentifierValueToNull ( )
pure virtual

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).

Implemented in QgsFeatureFilterModel, and QgsFeaturePickerModel.

◆ setExtraIdentifierValueUnguarded()

void QgsFeaturePickerModelBase::setExtraIdentifierValueUnguarded ( const QVariant &  identifierValue)
protected

This will set the identifier value to be set in the model even if it doesn't exist currently in the data.

Definition at line 479 of file qgsfeaturepickermodelbase.cpp.

◆ setFetchGeometry()

void QgsFeaturePickerModelBase::setFetchGeometry ( bool  fetchGeometry)

Defines if the geometry will be fetched.

Definition at line 572 of file qgsfeaturepickermodelbase.cpp.

◆ setFetchLimit()

void QgsFeaturePickerModelBase::setFetchLimit ( int  fetchLimit)

Defines the feature request fetch limit If set to 0, no limit is applied when fetching.

Definition at line 586 of file qgsfeaturepickermodelbase.cpp.

◆ setFilterExpression()

void QgsFeaturePickerModelBase::setFilterExpression ( const QString &  filterExpression)

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

Can be used for spatial filtering etc.

Definition at line 107 of file qgsfeaturepickermodelbase.cpp.

◆ setFilterValue()

void QgsFeaturePickerModelBase::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 90 of file qgsfeaturepickermodelbase.cpp.

◆ setSourceLayer()

void QgsFeaturePickerModelBase::setSourceLayer ( QgsVectorLayer sourceLayer)

The source layer from which features will be fetched.

Definition at line 50 of file qgsfeaturepickermodelbase.cpp.

◆ sourceLayer()

QgsVectorLayer * QgsFeaturePickerModelBase::sourceLayer ( ) const

The source layer from which features will be fetched.

Definition at line 44 of file qgsfeaturepickermodelbase.cpp.

◆ sourceLayerChanged

void QgsFeaturePickerModelBase::sourceLayerChanged ( )
signal

The source layer from which features will be fetched.

Friends And Related Symbol Documentation

◆ TestQgsFeatureListComboBox

friend class TestQgsFeatureListComboBox
friend

Definition at line 364 of file qgsfeaturepickermodelbase.h.

Member Data Documentation

◆ mEntries

QVector<QgsFeatureExpressionValuesGatherer::Entry> QgsFeaturePickerModelBase::mEntries
protected

Definition at line 327 of file qgsfeaturepickermodelbase.h.

◆ mExtraIdentifierValue

QVariant QgsFeaturePickerModelBase::mExtraIdentifierValue
protected

The current identifier value.

Definition at line 331 of file qgsfeaturepickermodelbase.h.

◆ mExtraValueIndex

int QgsFeaturePickerModelBase::mExtraValueIndex = -1
protected

The current index.

Definition at line 334 of file qgsfeaturepickermodelbase.h.

Property Documentation

◆ allowNull

bool QgsFeaturePickerModelBase::allowNull
readwrite

Definition at line 40 of file qgsfeaturepickermodelbase.h.

◆ displayExpression

QString QgsFeaturePickerModelBase::displayExpression
readwrite

Definition at line 37 of file qgsfeaturepickermodelbase.h.

◆ extraIdentifierValueIndex

int QgsFeaturePickerModelBase::extraIdentifierValueIndex
read

Definition at line 43 of file qgsfeaturepickermodelbase.h.

◆ fetchGeometry

bool QgsFeaturePickerModelBase::fetchGeometry
readwrite

Definition at line 41 of file qgsfeaturepickermodelbase.h.

◆ fetchLimit

int QgsFeaturePickerModelBase::fetchLimit
readwrite

Definition at line 42 of file qgsfeaturepickermodelbase.h.

◆ filterExpression

QString QgsFeaturePickerModelBase::filterExpression
readwrite

Definition at line 39 of file qgsfeaturepickermodelbase.h.

◆ filterValue

QString QgsFeaturePickerModelBase::filterValue
readwrite

Definition at line 38 of file qgsfeaturepickermodelbase.h.

◆ sourceLayer

QgsVectorLayer * QgsFeaturePickerModelBase::sourceLayer
readwrite

Definition at line 36 of file qgsfeaturepickermodelbase.h.


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