Class: QgsRelationWidgetWrapper

A widget wrapper for relation widgets.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsRelationWidgetWrapper

Base classes

QgsWidgetWrapper

Manages an editor widget.

QObject

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]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

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.