Class: QgsFieldValuesLineEdit

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.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsFieldValuesLineEdit

Base classes

QgsFilterLineEdit

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

QLineEdit

QWidget

QObject

QPaintDevice

Methods

attributeIndex

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

layer

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

setAttributeIndex

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

setLayer

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

Signals

attributeIndexChanged

Emitted when the field associated with the widget changes.

layerChanged

Emitted when the layer associated with the widget changes.

class qgis.gui.QgsFieldValuesLineEdit[source]

Bases: QgsFilterLineEdit

__init__(parent: QWidget | None = None)

Constructor for QgsFieldValuesLineEdit

Parameters:

parent (Optional[QWidget] = None) – parent widget

attributeIndex(self) int[source]

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

See also

layer()

Return type:

int

signal attributeIndexChanged(index: int)[source]

Emitted when the field associated with the widget changes.

Parameters:

index (int) – new attribute index for field

layer(self) QgsVectorLayer | None[source]

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

See also

setLayer()

See also

attributeIndex()

Return type:

Optional[QgsVectorLayer]

signal layerChanged(layer: QgsVectorLayer)[source]

Emitted when the layer associated with the widget changes.

Parameters:

layer (QgsVectorLayer) – vector layer

setAttributeIndex(self, index: int)[source]

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

Parameters:

index (int) – index of attribute

See also

attributeIndex()

See also

setLayer()

setLayer(self, layer: QgsVectorLayer | None)[source]

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

Parameters:

layer (Optional[QgsVectorLayer]) – vector layer

See also

layer()