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.

New in version 3.18.

QgsRelationWidgetRegistry() Constructor

QgsRelationWidgetRegistry(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)

Adds a new registered relation widgetFactory

Parameters

widgetFactory (QgsAbstractRelationEditorWidgetFactory) –

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

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

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

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

  • parent (QWidget = None) –

Return type

QgsAbstractRelationEditorWidget

createConfigWidget(self, widgetType: str, relation: QgsRelation, parent: QWidget = None)QgsAbstractRelationEditorConfigWidget

Creates a configuration widget

Parameters
  • widgetType (str) – The widget type to create a configuration widget for

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

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

Return type

QgsAbstractRelationEditorConfigWidget

defaultWidgetType(self)str

Returns the default editor widget type.

New in version 3.20.

Return type

str

factories(self)object

Gets access to all registered factories

Return type

object

relationWidgetNames(self)List[str]

Returns a list of names of registered relation widgets

Return type

List[str]

removeRelationWidget(self, widgetType: str)

Removes a registered relation widget with given widgetType

Parameters

widgetType (str) –

setDefaultWidgetType(self, widgetType: str)

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

Parameters

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

New in version 3.20.