Class: QgsRelationWidgetWrapper

A widget wrapper for relation widgets.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsRelationWidgetWrapper

Base classes

QgsWidgetWrapper

Manages an editor widget.

QObject

Methods

forceSuppressFormPopup

Determines the force suppress form popup status that is configured for this widget

label

Determines the label of this element

nmRelationId

Determines the relation id of the second relation involved in an N:M relation.

relation

The relation for which this wrapper is created.

setForceSuppressFormPopup

Sets force suppress form popup status to forceSuppressFormPopup for this widget and for the vectorLayerTools (if True).

setLabel

Sets label for this element If it's empty it takes the relation id as label

setMultiEditFeatureIds

Set multiple feature to edit simultaneously.

setNmRelationId

Sets nmRelationId for the relation id of the second relation involved in an N:M relation.

setShowLabel

Defines if a title label should be shown for this widget.

setShowLinkButton

Determines if the "link feature" button should be shown

setShowSaveChildEditsButton

Determines if the "Save child layer edits" button should be shown

setShowUnlinkButton

Determines if the "unlink feature" button should be shown

setVisible

Sets the visibility of the wrapper's widget.

setVisibleButtons

Defines the buttons which are shown

setWidgetConfig

Will set the config of this widget wrapper to the specified config.

showLabel

Defines if a title label should be shown for this widget.

showLinkButton

Determines if the "link feature" button should be shown

showSaveChildEditsButton

Determines if the "Save child layer edits" button should be shown

showUnlinkButton

Determines if the "unlink feature" button should be shown

visibleButtons

Returns the buttons which are shown

widgetConfig

Returns the whole widget config

widgetValueChanged

Will be called when a value in the current edited form or table row changes

Signals

relatedFeaturesChanged

Emit this signal, whenever the related features changed.

class qgis.gui.QgsRelationWidgetWrapper[source]

Bases: QgsWidgetWrapper

__init__(vl: QgsVectorLayer | None, relation: QgsRelation, editor: QWidget | None = None, parent: QWidget | None = None)

Constructor for QgsRelationWidgetWrapper

Parameters:
__init__(relationEditorName: str | None, vl: QgsVectorLayer | None, relation: QgsRelation, editor: QWidget | None = None, parent: QWidget | None = None)

Constructor for QgsRelationWidgetWrapper

Parameters:
  • relationEditorName (Optional[str])

  • vl (Optional[QgsVectorLayer])

  • relation (QgsRelation)

  • editor (Optional[QWidget] = None)

  • parent (Optional[QWidget] = None)

forceSuppressFormPopup(self) bool[source]

Determines the force suppress form popup status that is configured for this widget

Added in version 3.16.

Return type:

bool

label(self) str[source]

Determines the label of this element

Added in version 3.16.

Deprecated since version 3.20: Label is handled directly in QgsAttributeForm.

Return type:

str

nmRelationId(self) Any[source]

Determines the relation id of the second relation involved in an N:M relation.

Added in version 3.16.

Return type:

Any

signal relatedFeaturesChanged[source]

Emit this signal, whenever the related features changed. This happens for example when related features are added, removed, linked or unlinked.

Added in version 3.22.

relation(self) QgsRelation[source]

The relation for which this wrapper is created.

Return type:

QgsRelation

setForceSuppressFormPopup(self, forceSuppressFormPopup: bool)[source]

Sets force suppress form popup status to forceSuppressFormPopup for this widget and for the vectorLayerTools (if True). This flag will override the layer and general settings regarding the automatic opening of the attribute form dialog when digitizing is completed.

Added in version 3.16.

Parameters:

forceSuppressFormPopup (bool)

setLabel(self, label: str | None = '')[source]

Sets label for this element If it’s empty it takes the relation id as label

Added in version 3.16.

Deprecated since version 3.20: Label is handled directly in QgsAttributeForm.

Parameters:

label (Optional[str] = '')

setMultiEditFeatureIds(self, fids: Any)[source]

Set multiple feature to edit simultaneously.

Parameters:

fids (Any) – Multiple Id of features to edit

Added in version 3.24.

setNmRelationId(self, nmRelationId: Any = None)[source]

Sets nmRelationId for the relation id of the second relation involved in an N:M relation. If it’s empty, then it’s considered as a 1:M relationship.

Added in version 3.16.

Parameters:

nmRelationId (Any = None)

setShowLabel(self, showLabel: bool)[source]

Defines if a title label should be shown for this widget. Only has an effect after widget() has been called at least once.

Deprecated since version 3.20: Label is handled directly in QgsAttributeForm.

Parameters:

showLabel (bool)

setShowLinkButton(self, showLinkButton: bool)[source]

Determines if the “link feature” button should be shown

Deprecated since version 3.16: Use setVisibleButtons() instead.

Parameters:

showLinkButton (bool)

setShowSaveChildEditsButton(self, showChildEdits: bool)[source]

Determines if the “Save child layer edits” button should be shown

Added in version 3.14.

Deprecated since version 3.16: Use setVisibleButtons() instead.

Parameters:

showChildEdits (bool)

setShowUnlinkButton(self, showUnlinkButton: bool)[source]

Determines if the “unlink feature” button should be shown

Deprecated since version 3.16: Use setVisibleButtons() instead.

Parameters:

showUnlinkButton (bool)

setVisible(self, visible: bool)[source]

Sets the visibility of the wrapper’s widget.

Parameters:

visible (bool) – set to True to show widget, False to hide widget

setVisibleButtons(self, buttons: QgsAttributeEditorRelation.Buttons | QgsAttributeEditorRelation.Button)[source]

Defines the buttons which are shown

Added in version 3.16.

Deprecated since version 3.18: Use setWidgetConfig() instead.

Parameters:

buttons (Union[QgsAttributeEditorRelation.Buttons, QgsAttributeEditorRelation.Button])

setWidgetConfig(self, config: Dict[str, Any])[source]

Will set the config of this widget wrapper to the specified config.

Parameters:

config (Dict[str, Any]) – The config for this wrapper

Added in version 3.18.

showLabel(self) bool[source]

Defines if a title label should be shown for this widget. Only has an effect after widget() has been called at least once.

Deprecated since version 3.20: Label is handled directly in QgsAttributeForm.

Return type:

bool

showLinkButton(self) bool[source]

Determines if the “link feature” button should be shown

Deprecated since version 3.16: Use visibleButtons() instead.

Return type:

bool

showSaveChildEditsButton(self) bool[source]

Determines if the “Save child layer edits” button should be shown

Added in version 3.14.

Deprecated since version 3.16: Use visibleButtons() instead.

Return type:

bool

showUnlinkButton(self) bool[source]

Determines if the “unlink feature” button should be shown

Deprecated since version 3.16: Use visibleButtons() instead.

Return type:

bool

visibleButtons(self) QgsAttributeEditorRelation.Buttons[source]

Returns the buttons which are shown

Added in version 3.16.

Deprecated since version 3.18: Use widgetConfig() instead.

Return type:

QgsAttributeEditorRelation.Buttons

widgetConfig(self) Dict[str, Any][source]

Returns the whole widget config

Added in version 3.18.

Return type:

Dict[str, Any]

widgetValueChanged(self, attribute: str | None, newValue: Any, attributeChanged: bool)[source]

Will be called when a value in the current edited form or table row changes

Forward the signal to the embedded form

Parameters:
  • attribute (Optional[str]) – The name of the attribute that changed.

  • newValue (Any) – The new value of the attribute.

  • attributeChanged (bool) – If True, it corresponds to an actual change of the feature attribute

Added in version 3.14.