Class: QgsEditorConfigWidget

Base class for widgets which configure editor widget types.

This class should be subclassed for every configurable editor widget type.

It implements the GUI configuration widget and transforms this to/from a configuration.

It will only be instantiated by {QgsEditorWidgetFactory}

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: config(), setConfig()

Class Hierarchy

Inheritance diagram of qgis.gui.QgsEditorConfigWidget

Base classes

QWidget

QObject

QPaintDevice

QgsExpressionContextGenerator

Abstract interface for generating an expression context.

Abstract Methods

config

Create a configuration from the current GUI state

setConfig

Update the configuration widget to represent the given configuration.

Methods

field

Returns the field for which this configuration widget applies

initializeDataDefinedButton

Registers a property override button, setting up its initial value, connections and description.

layer

Returns the layer for which this configuration widget applies

updateDataDefinedButton

Updates a specific property override button to reflect the widgets's current properties.

updateDataDefinedButtons

Updates all property override buttons to reflect the widgets's current properties.

Signals

changed

Emitted when the configuration of the widget is changed.

class qgis.gui.QgsEditorConfigWidget[source]

Bases: QWidget, QgsExpressionContextGenerator

__init__(vl: QgsVectorLayer | None, fieldIdx: int, parent: QWidget | None)

Create a new configuration widget

Parameters:
  • vl (Optional[QgsVectorLayer]) – The layer for which the configuration dialog will be created

  • fieldIdx (int) – The index of the field on the layer for which this dialog will be created

  • parent (Optional[QWidget]) – A parent widget

signal changed[source]

Emitted when the configuration of the widget is changed.

abstract config(self) Dict[str, Any][source]

Create a configuration from the current GUI state

Return type:

Dict[str, Any]

Returns:

A widget configuration

field(self) int[source]

Returns the field for which this configuration widget applies

Return type:

int

Returns:

The field index

initializeDataDefinedButton(self, button: QgsPropertyOverrideButton | None, key: QgsWidgetWrapper.Property)[source]

Registers a property override button, setting up its initial value, connections and description.

Parameters:
layer(self) QgsVectorLayer | None[source]

Returns the layer for which this configuration widget applies

Return type:

Optional[QgsVectorLayer]

Returns:

The layer

abstract setConfig(self, config: Dict[str, Any])[source]

Update the configuration widget to represent the given configuration.

Parameters:

config (Dict[str, Any]) – The configuration which should be represented by this widget

updateDataDefinedButton(self, button: QgsPropertyOverrideButton | None)[source]

Updates a specific property override button to reflect the widgets’s current properties.

Parameters:

button (Optional[QgsPropertyOverrideButton])

updateDataDefinedButtons(self)[source]

Updates all property override buttons to reflect the widgets’s current properties.