QGIS API Documentation  3.2.0-Bonn (bc43194)
Classes | Signals | Public Member Functions | Properties | List of all members
QgsFeatureListComboBox Class Reference

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

#include <qgsfeaturelistcombobox.h>

Inheritance diagram for QgsFeatureListComboBox:
Inheritance graph
[legend]

Signals

void allowNullChanged ()
 Determines if a NULL value should be available in the list. More...
 
void displayExpressionChanged ()
 The display expression will be used to display features as well as the the value to match the typed text against. More...
 
void filterExpressionChanged ()
 An additional expression to further restrict the available features. More...
 
void identifierFieldChanged ()
 Field name that will be used to uniquely identify the current feature. More...
 
void identifierValueChanged ()
 The identifier value of the currently selected feature. More...
 
void modelUpdated ()
 The underlying model has been updated. More...
 
void sourceLayerChanged ()
 The layer from which features should be listed. More...
 

Public Member Functions

 QgsFeatureListComboBox (QWidget *parent=nullptr)
 Create a new QgsFeatureListComboBox, optionally specifying a parent. More...
 
bool allowNull () const
 Determines if a NULL value should be available in the list. More...
 
QgsFeatureRequest currentFeatureRequest () const
 Shorthand for getting a feature request to query the currently selected feature. More...
 
QModelIndex currentModelIndex () const
 The index of the currently selected item. More...
 
QString displayExpression () const
 The display expression will be used to display features as well as the the value to match the typed text against. More...
 
QString filterExpression () const
 An additional expression to further restrict the available features. More...
 
void focusOutEvent (QFocusEvent *event) override
 
QString identifierField () const
 Field name that will be used to uniquely identify the current feature. More...
 
QVariant identifierValue () const
 The identifier value of the currently selected feature. More...
 
void keyPressEvent (QKeyEvent *event) override
 
int nullIndex () const
 Returns the current index of the NULL value, or -1 if NULL values are not allowed. More...
 
void setAllowNull (bool allowNull)
 Determines if a NULL value should be available in the list. More...
 
void setDisplayExpression (const QString &displayExpression)
 The display expression will be used to display features as well as the the value to match the typed text against. More...
 
void setFilterExpression (const QString &filterExpression)
 An additional expression to further restrict the available features. More...
 
void setIdentifierField (const QString &identifierField)
 Field name that will be used to uniquely identify the current feature. More...
 
void setIdentifierValue (const QVariant &identifierValue)
 The identifier value of the currently selected feature. More...
 
void setSourceLayer (QgsVectorLayer *sourceLayer)
 The layer from which features should be listed. More...
 
QgsVectorLayersourceLayer () const
 The layer from which features should be listed. More...
 

Properties

bool allowNull
 
QString displayExpression
 
QString filterExpression
 
QString identifierField
 
QVariant identifierValue
 
QgsVectorLayer sourceLayer
 

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.

Since
QGIS 3.0

Definition at line 39 of file qgsfeaturelistcombobox.h.

Constructor & Destructor Documentation

◆ QgsFeatureListComboBox()

QgsFeatureListComboBox::QgsFeatureListComboBox ( QWidget *  parent = nullptr)

Create a new QgsFeatureListComboBox, optionally specifying a parent.

Definition at line 27 of file qgsfeaturelistcombobox.cpp.

Member Function Documentation

◆ allowNull()

bool QgsFeatureListComboBox::allowNull ( ) const

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

◆ allowNullChanged

void QgsFeatureListComboBox::allowNullChanged ( )
signal

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

◆ currentFeatureRequest()

QgsFeatureRequest QgsFeatureListComboBox::currentFeatureRequest ( ) const

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

Definition at line 217 of file qgsfeaturelistcombobox.cpp.

◆ currentModelIndex()

QModelIndex QgsFeatureListComboBox::currentModelIndex ( ) const

The index of the currently selected item.

Definition at line 176 of file qgsfeaturelistcombobox.cpp.

◆ displayExpression()

QString QgsFeatureListComboBox::displayExpression ( ) const

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

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

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

◆ 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 181 of file qgsfeaturelistcombobox.cpp.

◆ identifierField()

QString QgsFeatureListComboBox::identifierField ( ) const

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

Normally the primary key of the layer.

◆ identifierFieldChanged

void QgsFeatureListComboBox::identifierFieldChanged ( )
signal

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

Normally the primary key of the layer.

◆ identifierValue()

QVariant QgsFeatureListComboBox::identifierValue ( ) const

The identifier value of the currently selected feature.

A value from the identifierField.

◆ identifierValueChanged

void QgsFeatureListComboBox::identifierValueChanged ( )
signal

The identifier value of the currently selected feature.

A value from the identifierField.

◆ keyPressEvent()

void QgsFeatureListComboBox::keyPressEvent ( QKeyEvent *  event)
override

Definition at line 188 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 140 of file qgsfeaturelistcombobox.cpp.

◆ setAllowNull()

void QgsFeatureListComboBox::setAllowNull ( bool  allowNull)

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

Definition at line 202 of file qgsfeaturelistcombobox.cpp.

◆ setDisplayExpression()

void QgsFeatureListComboBox::setDisplayExpression ( const QString &  displayExpression)

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

Definition at line 80 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.

TODO!

Definition at line 230 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.

Definition at line 171 of file qgsfeaturelistcombobox.cpp.

◆ setIdentifierValue()

void QgsFeatureListComboBox::setIdentifierValue ( const QVariant &  identifierValue)

The identifier value of the currently selected feature.

A value from the identifierField.

Definition at line 212 of file qgsfeaturelistcombobox.cpp.

◆ setSourceLayer()

void QgsFeatureListComboBox::setSourceLayer ( QgsVectorLayer sourceLayer)

The layer from which features should be listed.

Definition at line 70 of file qgsfeaturelistcombobox.cpp.

◆ sourceLayer()

QgsVectorLayer* QgsFeatureListComboBox::sourceLayer ( ) const

The layer from which features should be listed.

◆ sourceLayerChanged

void QgsFeatureListComboBox::sourceLayerChanged ( )
signal

The layer from which features should be listed.

Property Documentation

◆ allowNull

bool QgsFeatureListComboBox::allowNull
readwrite

Definition at line 48 of file qgsfeaturelistcombobox.h.

◆ displayExpression

QString QgsFeatureListComboBox::displayExpression
readwrite

Definition at line 44 of file qgsfeaturelistcombobox.h.

◆ filterExpression

QString QgsFeatureListComboBox::filterExpression
readwrite

Definition at line 45 of file qgsfeaturelistcombobox.h.

◆ identifierField

QString QgsFeatureListComboBox::identifierField
readwrite

Definition at line 47 of file qgsfeaturelistcombobox.h.

◆ identifierValue

QVariant QgsFeatureListComboBox::identifierValue
readwrite

Definition at line 46 of file qgsfeaturelistcombobox.h.

◆ sourceLayer

QgsVectorLayer * QgsFeatureListComboBox::sourceLayer
readwrite

Definition at line 43 of file qgsfeaturelistcombobox.h.


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