QgsFieldValuesLineEdit class

A line edit with an autocompleter which takes unique values from a vector layer's fields.

The autocompleter is populated from the vector layer in the background to ensure responsive interaction with the widget.

Base classes

class QgsFilterLineEdit
QLineEdit subclass with built in support for clearing the widget's value and handling custom null value representations.

Constructors, destructors, conversion operators

QgsFieldValuesLineEdit(QWidget* parent = nullptr)
Constructor for QgsFieldValuesLineEdit.

Public functions

auto attributeIndex() const -> int
Returns the attribute index for the field containing values shown in the widget.
auto layer() const -> QgsVectorLayer*
Returns the layer containing the field that values will be shown from.
void setAttributeIndex(int index)
Sets the attribute index for the field containing values to show in the widget.
void setLayer(QgsVectorLayer* layer)
Sets the layer containing the field that values will be shown from.

Signals

void attributeIndexChanged(int index)
Emitted when the field associated with the widget changes.
void layerChanged(QgsVectorLayer* layer)
Emitted when the layer associated with the widget changes.

Function documentation

QgsFieldValuesLineEdit::QgsFieldValuesLineEdit(QWidget* parent = nullptr)

Constructor for QgsFieldValuesLineEdit.

Parameters
parent parent widget

int QgsFieldValuesLineEdit::attributeIndex() const

Returns the attribute index for the field containing values shown in the widget.

QgsVectorLayer* QgsFieldValuesLineEdit::layer() const

Returns the layer containing the field that values will be shown from.

void QgsFieldValuesLineEdit::setAttributeIndex(int index)

Sets the attribute index for the field containing values to show in the widget.

Parameters
index index of attribute

void QgsFieldValuesLineEdit::setLayer(QgsVectorLayer* layer)

Sets the layer containing the field that values will be shown from.

Parameters
layer vector layer

void QgsFieldValuesLineEdit::attributeIndexChanged(int index) signal

Emitted when the field associated with the widget changes.

Parameters
index new attribute index for field

void QgsFieldValuesLineEdit::layerChanged(QgsVectorLayer* layer) signal

Emitted when the layer associated with the widget changes.

Parameters
layer vector layer