Class: QgsRelationWidgetRegistry

class qgis.gui.QgsRelationWidgetRegistry

Bases: sip.wrapper

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.

QgsRelationWidgetRegistry() Constructor

QgsRelationWidgetRegistry(a0: QgsRelationWidgetRegistry)

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.

addRelationWidget(self, widgetFactory: QgsAbstractRelationEditorWidgetFactory | None)

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

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) – 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

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

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]

Returns a list of names of registered relation widgets

Return type:

List[str]

removeRelationWidget(self, widgetType: str | None)

Removes a registered relation widget with given widgetType

Parameters:

widgetType (Optional[str])

setDefaultWidgetType(self, widgetType: str | None)

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.