Class: QgsRelationWidgetRegistry

Keeps track of the registered relations widgets.

New widgets can be registered, old ones deleted.

The default {QgsRelationEditorWidget} is protected from removing.

Added in version 3.18.

Methods

addRelationWidget

Adds a new registered relation widgetFactory

create

Create a relation widget of a given type for a given field.

createConfigWidget

Creates a configuration widget

defaultWidgetType

Returns the default editor widget type.

factories

Gets access to all registered factories

relationWidgetNames

Returns a list of names of registered relation widgets

removeRelationWidget

Removes a registered relation widget with given widgetType

setDefaultWidgetType

Sets the default editor widget type.

class qgis.gui.QgsRelationWidgetRegistry[source]

Bases: object

__init__()

Constructor

__init__(a0: QgsRelationWidgetRegistry)
Parameters:

a0 (QgsRelationWidgetRegistry)

addRelationWidget(self, widgetFactory: QgsAbstractRelationEditorWidgetFactory | None)[source]

Adds a new registered relation widgetFactory

Parameters:

widgetFactory (Optional[QgsAbstractRelationEditorWidgetFactory])

create(self, widgetType: str | None, config: Dict[str, Any], parent: QWidget | None = None) QgsAbstractRelationEditorWidget | None[source]

Create a relation widget of a given type for a given field.

Parameters:
  • widgetType (Optional[str]) – The widget type to create a relation editor for

  • config (Dict[str, Any]) – The configuration of the widget

  • parent (Optional[QWidget] = None)

Return type:

Optional[QgsAbstractRelationEditorWidget]

createConfigWidget(self, widgetType: str | None, relation: QgsRelation, parent: QWidget | None = None) QgsAbstractRelationEditorConfigWidget | None[source]

Creates a configuration widget

Parameters:
  • widgetType (Optional[str]) – The widget type to create a configuration widget for

  • relation (QgsRelation) – The relation for which this widget will be created

  • parent (Optional[QWidget] = None) – The parent widget for the created widget

Return type:

Optional[QgsAbstractRelationEditorConfigWidget]

defaultWidgetType(self) str[source]

Returns the default editor widget type.

Added in version 3.20.

Return type:

str

factories(self) Any

Gets access to all registered factories

Return type:

Any

relationWidgetNames(self) List[str][source]

Returns a list of names of registered relation widgets

Return type:

List[str]

removeRelationWidget(self, widgetType: str | None)[source]

Removes a registered relation widget with given widgetType

Parameters:

widgetType (Optional[str])

setDefaultWidgetType(self, widgetType: str | None)[source]

Sets the default editor widget type. Does nothing if the provided widget type is not present.

Parameters:

widgetType (Optional[str]) – The widget type to be used by default.

Added in version 3.20.