QGIS API Documentation  3.17.0-Master (a84647cf30)
Signals | Public Member Functions | Properties | List of all members
QgsFeaturePickerWidget Class Reference

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

#include <qgsfeaturepickerwidget.h>

Inheritance diagram for QgsFeaturePickerWidget:
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 featureChanged (const QgsFeature &feature)
 Sends the feature as soon as it is chosen. More...
 
void fetchGeometryChanged ()
 Emitted when the fetching of the geometry changes. More...
 
void fetchLimitChanged ()
 Emitted when the fetching limit for the feature request changes. More...
 
void filterExpressionChanged ()
 An additional expression to further restrict the available features. More...
 
void layerChanged ()
 The layer from which features should be listed. More...
 
void modelUpdated ()
 The underlying model has been updated. More...
 
void showBrowserButtonsChanged ()
 Emitted when showing the browser buttons changes. More...
 

Public Member Functions

 QgsFeaturePickerWidget (QWidget *parent=nullptr)
 Create a new QgsFeaturePickerWidget, optionally specifying a parent. More...
 
bool allowNull () const
 Determines if a NULL value should be available in the list. 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 value to match the typed text against. More...
 
QgsFeature feature () const
 Returns the current feature. More...
 
bool fetchGeometry () const
 Returns if the geometry is fetched. More...
 
int fetchLimit () const
 Returns the feature request fetch limit. More...
 
QString filterExpression () const
 An additional expression to further restrict the available features. More...
 
void focusOutEvent (QFocusEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
QgsVectorLayerlayer () const
 The layer from which features should be listed. More...
 
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 value to match the typed text against. More...
 
void setFeature (QgsFeatureId featureId)
 Sets the current index by using the given feature. More...
 
void setFetchGeometry (bool fetchGeometry)
 Defines if the geometry will be fetched. More...
 
void setFetchLimit (int fetchLimit)
 Defines the feature request fetch limit If set to 0, no limit is applied when fetching. More...
 
void setFilterExpression (const QString &filterExpression)
 An additional expression to further restrict the available features. More...
 
void setLayer (QgsVectorLayer *layer)
 The layer from which features should be listed. More...
 
void setShowBrowserButtons (bool showBrowserButtons)
 Defines if the browsing buttons are shown. More...
 
bool showBrowserButtons () const
 Returns if the browsing buttons are shown. More...
 

Properties

bool allowNull
 
QString displayExpression
 
bool fetchGeometry
 
int fetchLimit
 
QString filterExpression
 
QgsVectorLayer layer
 
bool showBrowserButtons
 

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

Definition at line 44 of file qgsfeaturepickerwidget.h.

Constructor & Destructor Documentation

◆ QgsFeaturePickerWidget()

QgsFeaturePickerWidget::QgsFeaturePickerWidget ( QWidget *  parent = nullptr)

Create a new QgsFeaturePickerWidget, optionally specifying a parent.

Definition at line 24 of file qgsfeaturepickerwidget.cpp.

Member Function Documentation

◆ allowNull()

bool QgsFeaturePickerWidget::allowNull ( ) const

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

◆ allowNullChanged

void QgsFeaturePickerWidget::allowNullChanged ( )
signal

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

◆ currentModelIndex()

QModelIndex QgsFeaturePickerWidget::currentModelIndex ( ) const

The index of the currently selected item.

Definition at line 215 of file qgsfeaturepickerwidget.cpp.

◆ displayExpression()

QString QgsFeaturePickerWidget::displayExpression ( ) const

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

◆ displayExpressionChanged

void QgsFeaturePickerWidget::displayExpressionChanged ( )
signal

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

◆ feature()

QgsFeature QgsFeaturePickerWidget::feature ( ) const

Returns the current feature.

Definition at line 101 of file qgsfeaturepickerwidget.cpp.

◆ featureChanged

void QgsFeaturePickerWidget::featureChanged ( const QgsFeature feature)
signal

Sends the feature as soon as it is chosen.

◆ fetchGeometry()

bool QgsFeaturePickerWidget::fetchGeometry ( ) const

Returns if the geometry is fetched.

◆ fetchGeometryChanged

void QgsFeaturePickerWidget::fetchGeometryChanged ( )
signal

Emitted when the fetching of the geometry changes.

◆ fetchLimit()

int QgsFeaturePickerWidget::fetchLimit ( ) const

Returns the feature request fetch limit.

◆ fetchLimitChanged

void QgsFeaturePickerWidget::fetchLimitChanged ( )
signal

Emitted when the fetching limit for the feature request changes.

◆ filterExpression()

QString QgsFeaturePickerWidget::filterExpression ( ) const

An additional expression to further restrict the available features.

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

◆ filterExpressionChanged

void QgsFeaturePickerWidget::filterExpressionChanged ( )
signal

An additional expression to further restrict the available features.

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

◆ focusOutEvent()

void QgsFeaturePickerWidget::focusOutEvent ( QFocusEvent *  event)
override

Definition at line 220 of file qgsfeaturepickerwidget.cpp.

◆ keyPressEvent()

void QgsFeaturePickerWidget::keyPressEvent ( QKeyEvent *  event)
override

Definition at line 227 of file qgsfeaturepickerwidget.cpp.

◆ layer()

QgsVectorLayer* QgsFeaturePickerWidget::layer ( ) const

The layer from which features should be listed.

◆ layerChanged

void QgsFeaturePickerWidget::layerChanged ( )
signal

The layer from which features should be listed.

◆ modelUpdated

void QgsFeaturePickerWidget::modelUpdated ( )
signal

The underlying model has been updated.

◆ nullIndex()

int QgsFeaturePickerWidget::nullIndex ( ) const

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

Definition at line 183 of file qgsfeaturepickerwidget.cpp.

◆ setAllowNull()

void QgsFeaturePickerWidget::setAllowNull ( bool  allowNull)

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

Definition at line 241 of file qgsfeaturepickerwidget.cpp.

◆ setDisplayExpression()

void QgsFeaturePickerWidget::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 111 of file qgsfeaturepickerwidget.cpp.

◆ setFeature()

void QgsFeaturePickerWidget::setFeature ( QgsFeatureId  featureId)

Sets the current index by using the given feature.

Definition at line 96 of file qgsfeaturepickerwidget.cpp.

◆ setFetchGeometry()

void QgsFeaturePickerWidget::setFetchGeometry ( bool  fetchGeometry)

Defines if the geometry will be fetched.

Definition at line 262 of file qgsfeaturepickerwidget.cpp.

◆ setFetchLimit()

void QgsFeaturePickerWidget::setFetchLimit ( int  fetchLimit)

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

Definition at line 272 of file qgsfeaturepickerwidget.cpp.

◆ setFilterExpression()

void QgsFeaturePickerWidget::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 252 of file qgsfeaturepickerwidget.cpp.

◆ setLayer()

void QgsFeaturePickerWidget::setLayer ( QgsVectorLayer layer)

The layer from which features should be listed.

Definition at line 91 of file qgsfeaturepickerwidget.cpp.

◆ setShowBrowserButtons()

void QgsFeaturePickerWidget::setShowBrowserButtons ( bool  showBrowserButtons)

Defines if the browsing buttons are shown.

Note
Buttons are browsing the currently fetched features. If a limit is set, there might be more features to be fetched from the layer.

Definition at line 282 of file qgsfeaturepickerwidget.cpp.

◆ showBrowserButtons()

bool QgsFeaturePickerWidget::showBrowserButtons ( ) const

Returns if the browsing buttons are shown.

◆ showBrowserButtonsChanged

void QgsFeaturePickerWidget::showBrowserButtonsChanged ( )
signal

Emitted when showing the browser buttons changes.

Property Documentation

◆ allowNull

bool QgsFeaturePickerWidget::allowNull
readwrite

Definition at line 51 of file qgsfeaturepickerwidget.h.

◆ displayExpression

QString QgsFeaturePickerWidget::displayExpression
readwrite

Definition at line 49 of file qgsfeaturepickerwidget.h.

◆ fetchGeometry

bool QgsFeaturePickerWidget::fetchGeometry
readwrite

Definition at line 52 of file qgsfeaturepickerwidget.h.

◆ fetchLimit

int QgsFeaturePickerWidget::fetchLimit
readwrite

Definition at line 53 of file qgsfeaturepickerwidget.h.

◆ filterExpression

QString QgsFeaturePickerWidget::filterExpression
readwrite

Definition at line 50 of file qgsfeaturepickerwidget.h.

◆ layer

QgsVectorLayer * QgsFeaturePickerWidget::layer
readwrite

Definition at line 48 of file qgsfeaturepickerwidget.h.

◆ showBrowserButtons

bool QgsFeaturePickerWidget::showBrowserButtons
readwrite

Definition at line 54 of file qgsfeaturepickerwidget.h.


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