Class: QgsAttributeFormEditorWidget

A widget consisting of both an editor widget and additional widgets for controlling the behavior of the editor widget depending on a number of possible modes.

For instance, if the parent attribute form is in the multi edit mode, this widget will show both the editor widget and a tool button for controlling the multi edit results.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsAttributeFormEditorWidget

Base classes

QgsAttributeFormWidget

Base class for all widgets shown on a QgsAttributeForm. Consists of the widget which is visible in edit mode as well as the widget visible in search mode.

QWidget

QObject

QPaintDevice

Methods

changesCommitted

Called when field values have been committed;

currentValue

Returns the current value of the attached editor widget.

editorWidget

Returns the editor widget wrapper

hasChanged

Returns True if the widget's value has been changed since it was initialized.

initialize

Resets the widget to an initial value.

setConstraintResultVisible

Set the constraint result label visible or invisible according to the layer editable status

setConstraintStatus

Set the constraint status for this widget.

setIsMixed

Sets whether the widget should be displayed in a "mixed values" mode.

setVisiblePageForMode

Signals

valueChanged

Emitted when the widget's value changes

valuesChanged

Emitted when the widget's value changes

class qgis.gui.QgsAttributeFormEditorWidget[source]

Bases: QgsAttributeFormWidget

__init__(editorWidget: QgsEditorWidgetWrapper | None, widgetType: str | None, form: QgsAttributeForm | None)

Constructor for QgsAttributeFormEditorWidget.

Parameters:
  • editorWidget (Optional[QgsEditorWidgetWrapper]) – associated editor widget wrapper (for default/edit modes)

  • widgetType (Optional[str]) – the type identifier of the widget passed in the wrapper

  • form (Optional[QgsAttributeForm]) – parent attribute form

changesCommitted(self)[source]

Called when field values have been committed;

currentValue(self) Any[source]

Returns the current value of the attached editor widget.

Return type:

Any

editorWidget(self) QgsEditorWidgetWrapper | None[source]

Returns the editor widget wrapper

Added in version 3.10.

Return type:

Optional[QgsEditorWidgetWrapper]

hasChanged(self) bool[source]

Returns True if the widget’s value has been changed since it was initialized.

See also

initialize()

Return type:

bool

initialize(self, initialValue: Any, mixedValues: bool = False, additionalFieldValues: Iterable[Any] = [])[source]

Resets the widget to an initial value.

Parameters:
  • initialValue (Any) – initial value to show in widget

  • mixedValues (bool = False) – set to True to initially show the mixed values state

  • additionalFieldValues (Iterable[Any] = []) – a variant map of additional field names with their corresponding values

setConstraintResultVisible(self, editable: bool)[source]

Set the constraint result label visible or invisible according to the layer editable status

Parameters:

editable (bool)

setConstraintStatus(self, constraint: str | None, description: str | None, err: str | None, result: QgsEditorWidgetWrapper.ConstraintResult)[source]

Set the constraint status for this widget.

Parameters:
setIsMixed(self, mixed: bool)[source]

Sets whether the widget should be displayed in a “mixed values” mode.

Parameters:

mixed (bool) – set to True to show in a mixed values state

setVisiblePageForMode()
signal valueChanged(value: object)[source]

Emitted when the widget’s value changes

Parameters:

value (object) – new widget value

Deprecated since version 3.10: Use valuesChanged() instead.

signal valuesChanged(value: object, additionalFieldValues: List[object])[source]

Emitted when the widget’s value changes

Parameters:
  • value (object) – new widget value

  • additionalFieldValues (List[object]) – of the potential additional fields

Added in version 3.10.