QgsFeatureListComboBox class
This offers a combobox with autocompleter that allows selecting features from a layer.
Contents
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.
Constructors, destructors, conversion operators
- QgsFeatureListComboBox(QWidget* parent = nullptr)
- Create a new QgsFeatureListComboBox, optionally specifying a parent.
Public functions
- auto allowNull() const -> bool
- Determines if a NULL value should be available in the list.
- auto currentFeatureRequest() const -> QgsFeatureRequest
- Shorthand for getting a feature request to query the currently selected feature.
- auto currentModelIndex() const -> QModelIndex
- The index of the currently selected item.
- auto displayExpression() const -> QString
- The display expression will be used to display features as well as the value to match the typed text against.
- auto filterExpression() const -> QString
- An additional expression to further restrict the available features.
- auto identifierField() const -> QString
- Field name that will be used to uniquely identify the current feature.
- auto identifierValue() const -> QVariant
- The identifier value of the currently selected feature.
- auto nullIndex() const -> int
- Returns the current index of the NULL value, or -1 if NULL values are not allowed.
- void setAllowNull(bool allowNull)
- Determines if a NULL value should be available in the list.
- 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 setFilterExpression(const QString& filterExpression)
- An additional expression to further restrict the available features.
- void setIdentifierField(const QString& identifierField)
- Field name that will be used to uniquely identify the current feature.
- void setIdentifierValue(const QVariant& identifierValue)
- The identifier value of the currently selected feature.
- void setSourceLayer(QgsVectorLayer* sourceLayer)
- The layer from which features should be listed.
- auto sourceLayer() const -> QgsVectorLayer*
- The layer from which features should be listed.
Signals
- void allowNullChanged()
- Determines if a NULL value should be available in the list.
- 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 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 sourceLayerChanged()
- The layer from which features should be listed.
Function documentation
QString QgsFeatureListComboBox:: filterExpression() const
An additional expression to further restrict the available features.
This can be used to integrate additional spatial or other constraints.
QString QgsFeatureListComboBox:: identifierField() const
Field name that will be used to uniquely identify the current feature.
Normally the primary key of the layer.
QVariant QgsFeatureListComboBox:: identifierValue() const
The identifier value of the currently selected feature.
A value from the identifierField.
int QgsFeatureListComboBox:: nullIndex() const
Returns the current index of the NULL value, or -1 if NULL values are not allowed.
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.
TODO!
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.
void QgsFeatureListComboBox:: setIdentifierValue(const QVariant& identifierValue)
The identifier value of the currently selected feature.
A value from the identifierField.
void QgsFeatureListComboBox:: filterExpressionChanged() signal
An additional expression to further restrict the available features.
This can be used to integrate additional spatial or other constraints.
void QgsFeatureListComboBox:: identifierFieldChanged() signal
Field name that will be used to uniquely identify the current feature.
Normally the primary key of the layer.
void QgsFeatureListComboBox:: identifierValueChanged() signal
The identifier value of the currently selected feature.
A value from the identifierField.
void QgsFeatureListComboBox:: modelUpdated() signal
The underlying model has been updated.