Class: QgsSettingsEditorWidgetWrapper

Base class for settings editor wrappers.

Added in version 3.32.

Note

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

The following methods must be implemented: configureEditorPrivate(), createEditorPrivate(), createWrapper(), enableAutomaticUpdatePrivate(), id(), setSettingFromWidget(), setWidgetFromSetting(), setWidgetFromVariant(), variantValueFromWidget()

Class Hierarchy

Inheritance diagram of qgis.gui.QgsSettingsEditorWidgetWrapper

Base classes

QObject

Subclasses

QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase

Base factory for editors for settings.

QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase

Base factory for editors for settings.

QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase

Base factory for editors for settings.

QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase

Base factory for editors for settings.

QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQComboBoxQStringBase

Base factory for editors for settings.

QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase

Base factory for editors for settings.

PyQgsSettingsEnumEditorWidgetWrapper

A settings editor widget wrapper for enum settings as PyQgsSettingsEntryEnumFlag

Abstract Methods

configureEditorPrivate

Configures an existing editor widget

createEditorPrivate

Creates the widgets

createWrapper

Creates a new instance of the editor wrapper so it can be configured for a widget and a setting

enableAutomaticUpdatePrivate

Enables automatic update, which causes the setting to be updated immediately when the widget value is changed.

id

This id of the type of settings it handles

setSettingFromWidget

Sets the setting value from the widget value The wrapper must be configured before calling this medthod

setWidgetFromSetting

Sets the widget value from the setting value The wrapper must be configured before calling this medthod

setWidgetFromVariant

Sets the value of the widget The wrapper must be configured before calling this medthod

variantValueFromWidget

Returns the value from the widget as a variant The wrapper must be configured before calling this medthod

Methods

configureAutomaticUpdate

Configure the settings update behavior when a widget value is changed.

configureEditor

Configures the editor according the setting

createEditor

Creates the editor widget for the given setting

dynamicKeyPartList

Returns the dynamic key parts

Static Methods

fromWidget

Creates a wrapper from the definition stored in a widget created by createEditor()

class qgis.gui.QgsSettingsEditorWidgetWrapper[source]

Bases: QObject

__init__(parent: QObject | None = None)

Constructor

Parameters:

parent (Optional[QObject] = None)

configureAutomaticUpdate(self, dialog: QDialog | None = None)[source]

Configure the settings update behavior when a widget value is changed.

If a dialog is provided, the setting will be updated when the dialog is accepted. If not, the setting will be updated directly at each widget value change.

Note

This must called after createEditor() or configureEditor().

Added in version 3.40.

Parameters:

dialog (Optional[QDialog] = None)

configureEditor(self, editor: QWidget | None, setting: QgsSettingsEntryBase | None, dynamicKeyPartList: Iterable[str | None] = []) bool[source]

Configures the editor according the setting

Parameters:
  • editor (Optional[QWidget])

  • setting (Optional[QgsSettingsEntryBase])

  • dynamicKeyPartList (Iterable[Optional[str]] = [])

Return type:

bool

abstract configureEditorPrivate(self, editor: QWidget | None, setting: QgsSettingsEntryBase | None) bool[source]

Configures an existing editor widget

Parameters:
Return type:

bool

createEditor(self, setting: QgsSettingsEntryBase | None, dynamicKeyPartList: Iterable[str | None] = [], parent: QWidget | None = None) QWidget | None[source]

Creates the editor widget for the given setting

Parameters:
  • setting (Optional[QgsSettingsEntryBase])

  • dynamicKeyPartList (Iterable[Optional[str]] = [])

  • parent (Optional[QWidget] = None)

Return type:

Optional[QWidget]

abstract createEditorPrivate(self, parent: QWidget | None = None) QWidget | None[source]

Creates the widgets

Parameters:

parent (Optional[QWidget] = None)

Return type:

Optional[QWidget]

abstract createWrapper(self, parent: QObject | None = None) QgsSettingsEditorWidgetWrapper | None[source]

Creates a new instance of the editor wrapper so it can be configured for a widget and a setting

Parameters:

parent (Optional[QObject] = None)

Return type:

Optional[QgsSettingsEditorWidgetWrapper]

dynamicKeyPartList(self) List[str][source]

Returns the dynamic key parts

Added in version 3.40.

Return type:

List[str]

abstract enableAutomaticUpdatePrivate(self)[source]

Enables automatic update, which causes the setting to be updated immediately when the widget value is changed.

Added in version 3.40.

static fromWidget(widget: QWidget | None) QgsSettingsEditorWidgetWrapper | None[source]

Creates a wrapper from the definition stored in a widget created by createEditor()

Parameters:

widget (Optional[QWidget])

Return type:

Optional[QgsSettingsEditorWidgetWrapper]

abstract id(self) str[source]

This id of the type of settings it handles

Note

This mostly correspond to the content of Qgis.SettingsType but it’s a string since custom Python implementation are possible.

Return type:

str

abstract setSettingFromWidget(self) bool[source]

Sets the setting value from the widget value The wrapper must be configured before calling this medthod

Return type:

bool

abstract setWidgetFromSetting(self) bool[source]

Sets the widget value from the setting value The wrapper must be configured before calling this medthod

Return type:

bool

abstract setWidgetFromVariant(self, value: Any) bool[source]

Sets the value of the widget The wrapper must be configured before calling this medthod

Parameters:

value (Any)

Return type:

bool

abstract variantValueFromWidget(self) Any[source]

Returns the value from the widget as a variant The wrapper must be configured before calling this medthod

Return type:

Any