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

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

signal rememberLastValueChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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

setRememberLastValue(self, remember: bool)[source]

Sets whether the widget value will be remembered for potential reuse when creating new features

Added in version 4.0.

Parameters:

remember (bool)

setVisiblePageForMode()
signal valueChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

signal valuesChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.