QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
QgsFeatureListComboBox Class Reference

This offers a combobox with autocompleter that allows selecting features from a layer. More...

#include <qgsfeaturelistcombobox.h>

Inheritance diagram for QgsFeatureListComboBox:

Signals

void allowNullChanged ()
 Determines if a NULL value should be available in the list.
void currentFeatureChanged ()
 Emitted when the current feature changes.
void currentFeatureFoundChanged (bool found)
 Emitted when the feature picker model changes its feature found state.
void displayExpressionChanged ()
 The display expression will be used to display features as well as the the value to match the typed text against.
void filterExpressionChanged ()
 An additional expression to further restrict the available features.
void formFeatureChanged ()
 An attribute form feature to be used alongside the filter expression.
void identifierFieldChanged ()
 Field name that will be used to uniquely identify the current feature.
void identifierValueChanged ()
 The identifier value of the currently selected feature.
void modelUpdated ()
 The underlying model has been updated.
void parentFormFeatureChanged ()
 A parent attribute form feature to be used alongside the filter expression.
void sourceLayerChanged ()
 The layer from which features should be listed.

Public Member Functions

 QgsFeatureListComboBox (QWidget *parent=nullptr)
 Create a new QgsFeatureListComboBox, optionally specifying a parent.
bool allowNull () const
 Determines if a NULL value should be available in the list.
QgsFeatureRequest currentFeatureRequest () const
 Shorthand for getting a feature request to query the currently selected feature.
QModelIndex currentModelIndex () const
 The index of the currently selected item.
QString displayExpression () const
 The display expression will be used to display features as well as the value to match the typed text against.
int fetchLimit () const
 Returns the feature request fetch limit.
QString filterExpression () const
 An additional expression to further restrict the available features.
void focusOutEvent (QFocusEvent *event) override
QgsFeature formFeature () const
 Returns an attribute form feature to be used with the filter expression.
Q_DECL_DEPRECATED QString identifierField () const
 Field name that will be used to uniquely identify the current feature.
QStringList identifierFields () const
 Field name that will be used to uniquely identify the current feature.
Q_DECL_DEPRECATED QVariant identifierValue () const
 The identifier value of the currently selected feature.
QVariantList identifierValues () const
 The identifier values of the currently selected feature.
void keyPressEvent (QKeyEvent *event) override
int nullIndex () const
 Returns the current index of the NULL value, or -1 if NULL values are not allowed.
QString orderExpression () const
 The order expression of the model.
QgsFeature parentFormFeature () const
 Returns a parent attribute form feature to be used with the filter expression.
void setAllowNull (bool allowNull)
 Determines if a NULL value should be available in the list.
void setCurrentFeature (const QgsFeature &feature)
 Sets the current index by using the given feature.
void setDisplayExpression (const QString &displayExpression)
 The display expression will be used to display features as well as the value to match the typed text against.
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 expression to further restrict the available features.
void setFormFeature (const QgsFeature &feature)
 Sets an attribute form feature to be used with the filter expression.
Q_DECL_DEPRECATED void setIdentifierField (const QString &identifierField)
 Field name that will be used to uniquely identify the current feature.
void setIdentifierFields (const QStringList &identifierFields)
 Field name that will be used to uniquely identify the current feature.
Q_DECL_DEPRECATED void setIdentifierValue (const QVariant &identifierValue)
 The identifier value of the currently selected feature.
void setIdentifierValues (const QVariantList &identifierValues)
 The identifier values of the currently selected feature.
void setIdentifierValuesToNull ()
 Sets the identifier values of the currently selected feature to NULL value(s).
void setOrderExpression (const QString &orderExpression)
 The order expression of the model.
void setParentFormFeature (const QgsFeature &feature)
 Sets a parent attribute form feature to be used with the filter expression.
void setSortOrder (const Qt::SortOrder sortOrder)
 The order direction of the model.
void setSourceLayer (QgsVectorLayer *sourceLayer)
 The layer from which features should be listed.
Qt::SortOrder sortOrder () const
 The order direction of the model.
QgsVectorLayersourceLayer () const
 The layer from which features should be listed.

Properties

bool allowNull
QString displayExpression
QString filterExpression
QString identifierField
QVariant identifierValue
QVariantList identifierValues
QgsVectorLayersourceLayer

Friends

class TestQgsFeatureListComboBox

Detailed Description

This offers a combobox with autocompleter that allows selecting features from a layer.

It will show up to 100 entries at a time. The entries can be chosen based on the displayExpression and whenever text is typed into the combobox, the completer and popup will adjust to features matching the typed text.

Definition at line 37 of file qgsfeaturelistcombobox.h.

Constructor & Destructor Documentation

◆ QgsFeatureListComboBox()

QgsFeatureListComboBox::QgsFeatureListComboBox ( QWidget * parent = nullptr)

Create a new QgsFeatureListComboBox, optionally specifying a parent.

Definition at line 29 of file qgsfeaturelistcombobox.cpp.

Member Function Documentation

◆ allowNull()

bool QgsFeatureListComboBox::allowNull ( ) const

Determines if a NULL value should be available in the list.

Definition at line 247 of file qgsfeaturelistcombobox.cpp.

◆ allowNullChanged

void QgsFeatureListComboBox::allowNullChanged ( )
signal

Determines if a NULL value should be available in the list.

◆ currentFeatureChanged

void QgsFeatureListComboBox::currentFeatureChanged ( )
signal

Emitted when the current feature changes.

Since
QGIS 3.16.5

◆ currentFeatureFoundChanged

void QgsFeatureListComboBox::currentFeatureFoundChanged ( bool found)
signal

Emitted when the feature picker model changes its feature found state.

Since
QGIS 3.38

◆ currentFeatureRequest()

QgsFeatureRequest QgsFeatureListComboBox::currentFeatureRequest ( ) const

Shorthand for getting a feature request to query the currently selected feature.

Definition at line 295 of file qgsfeaturelistcombobox.cpp.

◆ currentModelIndex()

QModelIndex QgsFeatureListComboBox::currentModelIndex ( ) const

The index of the currently selected item.

Definition at line 226 of file qgsfeaturelistcombobox.cpp.

◆ displayExpression()

QString QgsFeatureListComboBox::displayExpression ( ) const

The display expression will be used to display features as well as the value to match the typed text against.

Definition at line 99 of file qgsfeaturelistcombobox.cpp.

◆ displayExpressionChanged

void QgsFeatureListComboBox::displayExpressionChanged ( )
signal

The display expression will be used to display features as well as the the value to match the typed text against.

◆ fetchLimit()

int QgsFeatureListComboBox::fetchLimit ( ) const

Returns the feature request fetch limit.

Since
QGIS 3.32

Definition at line 258 of file qgsfeaturelistcombobox.cpp.

◆ filterExpression()

QString QgsFeatureListComboBox::filterExpression ( ) const

An additional expression to further restrict the available features.

This can be used to integrate additional spatial or other constraints.

Definition at line 325 of file qgsfeaturelistcombobox.cpp.

◆ filterExpressionChanged

void QgsFeatureListComboBox::filterExpressionChanged ( )
signal

An additional expression to further restrict the available features.

This can be used to integrate additional spatial or other constraints.

◆ focusOutEvent()

void QgsFeatureListComboBox::focusOutEvent ( QFocusEvent * event)
override

Definition at line 231 of file qgsfeaturelistcombobox.cpp.

◆ formFeature()

QgsFeature QgsFeatureListComboBox::formFeature ( ) const

Returns an attribute form feature to be used with the filter expression.

Since
QGIS 3.42.2

Definition at line 335 of file qgsfeaturelistcombobox.cpp.

◆ formFeatureChanged

void QgsFeatureListComboBox::formFeatureChanged ( )
signal

An attribute form feature to be used alongside the filter expression.

Since
QGIS 3.42.2

◆ identifierField()

QString QgsFeatureListComboBox::identifierField ( ) const

Field name that will be used to uniquely identify the current feature.

Normally the primary key of the layer.

Deprecated
QGIS 3.10

Definition at line 202 of file qgsfeaturelistcombobox.cpp.

◆ identifierFieldChanged

void QgsFeatureListComboBox::identifierFieldChanged ( )
signal

Field name that will be used to uniquely identify the current feature.

Normally the primary key of the layer.

◆ identifierFields()

QStringList QgsFeatureListComboBox::identifierFields ( ) const

Field name that will be used to uniquely identify the current feature.

Normally the primary key of the layer.

Since
QGIS 3.10

Definition at line 211 of file qgsfeaturelistcombobox.cpp.

◆ identifierValue()

QVariant QgsFeatureListComboBox::identifierValue ( ) const

The identifier value of the currently selected feature.

A value from the identifierField.

Deprecated
QGIS 3.10

Definition at line 268 of file qgsfeaturelistcombobox.cpp.

◆ identifierValueChanged

void QgsFeatureListComboBox::identifierValueChanged ( )
signal

The identifier value of the currently selected feature.

A value from the identifierField.

◆ identifierValues()

QVariantList QgsFeatureListComboBox::identifierValues ( ) const

The identifier values of the currently selected feature.

A value from the identifierField.

Since
QGIS 3.10

Definition at line 275 of file qgsfeaturelistcombobox.cpp.

◆ keyPressEvent()

void QgsFeatureListComboBox::keyPressEvent ( QKeyEvent * event)
override

Definition at line 238 of file qgsfeaturelistcombobox.cpp.

◆ modelUpdated

void QgsFeatureListComboBox::modelUpdated ( )
signal

The underlying model has been updated.

Since
QGIS 3.2

◆ nullIndex()

int QgsFeatureListComboBox::nullIndex ( ) const

Returns the current index of the NULL value, or -1 if NULL values are not allowed.

Since
QGIS 3.2

Definition at line 176 of file qgsfeaturelistcombobox.cpp.

◆ orderExpression()

QString QgsFeatureListComboBox::orderExpression ( ) const

The order expression of the model.

It is used to evaluate sort values of the combobox.

Since
QGIS 4.0

Definition at line 355 of file qgsfeaturelistcombobox.cpp.

◆ parentFormFeature()

QgsFeature QgsFeatureListComboBox::parentFormFeature ( ) const

Returns a parent attribute form feature to be used with the filter expression.

Since
QGIS 3.42.2

Definition at line 345 of file qgsfeaturelistcombobox.cpp.

◆ parentFormFeatureChanged

void QgsFeatureListComboBox::parentFormFeatureChanged ( )
signal

A parent attribute form feature to be used alongside the filter expression.

Since
QGIS 3.42.2

◆ setAllowNull()

void QgsFeatureListComboBox::setAllowNull ( bool allowNull)

Determines if a NULL value should be available in the list.

Definition at line 252 of file qgsfeaturelistcombobox.cpp.

◆ setCurrentFeature()

void QgsFeatureListComboBox::setCurrentFeature ( const QgsFeature & feature)

Sets the current index by using the given feature.

Since
QGIS 3.10

Definition at line 88 of file qgsfeaturelistcombobox.cpp.

◆ setDisplayExpression()

void QgsFeatureListComboBox::setDisplayExpression ( const QString & displayExpression)

The display expression will be used to display features as well as the value to match the typed text against.

Definition at line 104 of file qgsfeaturelistcombobox.cpp.

◆ setFetchLimit()

void QgsFeatureListComboBox::setFetchLimit ( int fetchLimit)

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

Since
QGIS 3.32

Definition at line 263 of file qgsfeaturelistcombobox.cpp.

◆ setFilterExpression()

void QgsFeatureListComboBox::setFilterExpression ( const QString & filterExpression)

An additional expression to further restrict the available features.

This can be used to integrate additional spatial or other constraints.

Definition at line 330 of file qgsfeaturelistcombobox.cpp.

◆ setFormFeature()

void QgsFeatureListComboBox::setFormFeature ( const QgsFeature & feature)

Sets an attribute form feature to be used with the filter expression.

Since
QGIS 3.42.2

Definition at line 340 of file qgsfeaturelistcombobox.cpp.

◆ setIdentifierField()

void QgsFeatureListComboBox::setIdentifierField ( const QString & identifierField)

Field name that will be used to uniquely identify the current feature.

Normally the primary key of the layer.

Deprecated
QGIS 3.10

Definition at line 216 of file qgsfeaturelistcombobox.cpp.

◆ setIdentifierFields()

void QgsFeatureListComboBox::setIdentifierFields ( const QStringList & identifierFields)

Field name that will be used to uniquely identify the current feature.

Normally the primary key of the layer.

Since
QGIS 3.10

Definition at line 221 of file qgsfeaturelistcombobox.cpp.

◆ setIdentifierValue()

void QgsFeatureListComboBox::setIdentifierValue ( const QVariant & identifierValue)

The identifier value of the currently selected feature.

A value from the identifierField.

Deprecated
QGIS 3.10. Use setIdentifierValues.

Definition at line 280 of file qgsfeaturelistcombobox.cpp.

◆ setIdentifierValues()

void QgsFeatureListComboBox::setIdentifierValues ( const QVariantList & identifierValues)

The identifier values of the currently selected feature.

A value from the identifierFields.

Since
QGIS 3.10

Definition at line 285 of file qgsfeaturelistcombobox.cpp.

◆ setIdentifierValuesToNull()

void QgsFeatureListComboBox::setIdentifierValuesToNull ( )

Sets the identifier values of the currently selected feature to NULL value(s).

Since
QGIS 3.10

Definition at line 290 of file qgsfeaturelistcombobox.cpp.

◆ setOrderExpression()

void QgsFeatureListComboBox::setOrderExpression ( const QString & orderExpression)

The order expression of the model.

It is used to evaluate sort values of the combobox.

Since
QGIS 4.0

Definition at line 360 of file qgsfeaturelistcombobox.cpp.

◆ setParentFormFeature()

void QgsFeatureListComboBox::setParentFormFeature ( const QgsFeature & feature)

Sets a parent attribute form feature to be used with the filter expression.

Since
QGIS 3.42.2

Definition at line 350 of file qgsfeaturelistcombobox.cpp.

◆ setSortOrder()

void QgsFeatureListComboBox::setSortOrder ( const Qt::SortOrder sortOrder)

The order direction of the model.

It defines the direction on sorting the combobox as ascending or descending.

Since
QGIS 4.0

Definition at line 370 of file qgsfeaturelistcombobox.cpp.

◆ setSourceLayer()

void QgsFeatureListComboBox::setSourceLayer ( QgsVectorLayer * sourceLayer)

The layer from which features should be listed.

Definition at line 83 of file qgsfeaturelistcombobox.cpp.

◆ sortOrder()

Qt::SortOrder QgsFeatureListComboBox::sortOrder ( ) const

The order direction of the model.

It defines the direction on sorting the combobox as ascending or descending.

Since
QGIS 4.0

Definition at line 365 of file qgsfeaturelistcombobox.cpp.

◆ sourceLayer()

QgsVectorLayer * QgsFeatureListComboBox::sourceLayer ( ) const

The layer from which features should be listed.

Definition at line 78 of file qgsfeaturelistcombobox.cpp.

◆ sourceLayerChanged

void QgsFeatureListComboBox::sourceLayerChanged ( )
signal

The layer from which features should be listed.

◆ TestQgsFeatureListComboBox

friend class TestQgsFeatureListComboBox
friend

Definition at line 339 of file qgsfeaturelistcombobox.h.

Property Documentation

◆ allowNull

bool QgsFeatureListComboBox::allowNull
readwrite

Definition at line 47 of file qgsfeaturelistcombobox.h.

◆ displayExpression

QString QgsFeatureListComboBox::displayExpression
readwrite

Definition at line 42 of file qgsfeaturelistcombobox.h.

◆ filterExpression

QString QgsFeatureListComboBox::filterExpression
readwrite

Definition at line 43 of file qgsfeaturelistcombobox.h.

◆ identifierField

QString QgsFeatureListComboBox::identifierField
readwrite

Definition at line 46 of file qgsfeaturelistcombobox.h.

◆ identifierValue

QVariant QgsFeatureListComboBox::identifierValue
readwrite

Definition at line 44 of file qgsfeaturelistcombobox.h.

◆ identifierValues

QVariantList QgsFeatureListComboBox::identifierValues
readwrite

Definition at line 45 of file qgsfeaturelistcombobox.h.

◆ sourceLayer

QgsVectorLayer * QgsFeatureListComboBox::sourceLayer
readwrite

Definition at line 41 of file qgsfeaturelistcombobox.h.


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