Class: QgsRelationWidgetWrapper

class qgis.gui.QgsRelationWidgetWrapper(vl: QgsVectorLayer, relation: QgsRelation, editor: QWidget = None, parent: QWidget = None)

Bases: QgsWidgetWrapper

Constructor for QgsRelationWidgetWrapper

QgsRelationWidgetWrapper(relationEditorName: str, vl: QgsVectorLayer, relation: QgsRelation, editor: QWidget = None, parent: QWidget = None) Constructor for QgsRelationWidgetWrapper

Methods

childEvent

connectNotify

createWidget

param parent:

customEvent

disconnectNotify

forceSuppressFormPopup

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

initWidget

param editor:

isSignalConnected

label

Determines the label of this element

nmRelationId

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

receivers

relation

The relation for which this wrapper is created.

sender

senderSignalIndex

setFeature

param feature:

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

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

timerEvent

valid

rtype:

bool

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

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

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createWidget(self, parent: QWidget) QWidget
Parameters:

parent (QWidget) –

Return type:

QWidget

customEvent(self, QEvent)
disconnectNotify(self, QMetaMethod)
forceSuppressFormPopup(self) bool

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

New in version 3.16.

Return type:

bool

initWidget(self, editor: QWidget)
Parameters:

editor (QWidget) –

isSignalConnected(self, QMetaMethod) bool
label(self) str

Determines the label of this element

New in version 3.16.

Deprecated since version QGIS: 3.20 label is handled directly in QgsAttributeForm.

Return type:

str

nmRelationId(self) Any

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

New in version 3.16.

Return type:

Any

receivers(self, PYQT_SIGNAL) int
relatedFeaturesChanged

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.

Parameters:
  • name (str = ...) –

  • revision (int = ...) –

  • arguments (Sequence = ...) –

Return type:

PYQT_SIGNAL

relation(self) QgsRelation

The relation for which this wrapper is created.

New in version 3.0.

Return type:

QgsRelation

sender(self) QObject
senderSignalIndex(self) int
setFeature(self, feature: QgsFeature)
Parameters:

feature (QgsFeature) –

setForceSuppressFormPopup(self, forceSuppressFormPopup: bool)

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.

New in version 3.16.

Parameters:

forceSuppressFormPopup (bool) –

setLabel(self, label: str = '')

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

New in version 3.16.

Deprecated since version QGIS: 3.20 label is handled directly in QgsAttributeForm.

Parameters:

label (str = '') –

setNmRelationId(self, nmRelationId: Any = None)

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.

New in version 3.16.

Parameters:

nmRelationId (Any = None) –

setShowLabel(self, showLabel: bool)

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

New in version 2.18.

Deprecated since version QGIS: 3.20 label is handled directly in QgsAttributeForm.

Parameters:

showLabel (bool) –

setShowLinkButton(self, showLinkButton: bool)

Determines if the “link feature” button should be shown

New in version 2.18.

Deprecated since version QGIS: 3.16 use setVisibleButtons() instead

Parameters:

showLinkButton (bool) –

setShowSaveChildEditsButton(self, showChildEdits: bool)

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

New in version 3.14.

Deprecated since version QGIS: 3.16 use setVisibleButtons() instead

Parameters:

showChildEdits (bool) –

setShowUnlinkButton(self, showUnlinkButton: bool)

Determines if the “unlink feature” button should be shown

New in version 2.18.

Deprecated since version QGIS: 3.16 use setVisibleButtons() instead

Parameters:

showUnlinkButton (bool) –

setVisible(self, visible: bool)

Sets the visibility of the wrapper’s widget.

Parameters:

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

New in version 2.16.

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

Defines the buttons which are shown

New in version 3.16.

Deprecated since version QGIS: 3.18 use setWidgetConfig() instead

Parameters:

buttons (Union[QgsAttributeEditorRelation.Buttons) –

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

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

Parameters:

config (Dict[str) – The config for this wrapper

New in version 3.18.

showLabel(self) bool

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

New in version 2.18.

Deprecated since version QGIS: 3.20 label is handled directly in QgsAttributeForm.

Return type:

bool

showLinkButton(self) bool

Determines if the “link feature” button should be shown

New in version 2.18.

Deprecated since version QGIS: 3.16 use visibleButtons() instead

Return type:

bool

showSaveChildEditsButton(self) bool

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

New in version 3.14.

Deprecated since version QGIS: 3.16 use visibleButtons() instead

Return type:

bool

showUnlinkButton(self) bool

Determines if the “unlink feature” button should be shown

New in version 2.18.

Deprecated since version QGIS: 3.16 use visibleButtons() instead

Return type:

bool

timerEvent(self, QTimerEvent)
valid(self) bool
Return type:

bool

visibleButtons(self) QgsAttributeEditorRelation.Buttons

Returns the buttons which are shown

New in version 3.16.

Deprecated since version QGIS: 3.18 use widgetConfig() instead

Return type:

QgsAttributeEditorRelation.Buttons

widgetConfig(self) Dict[str, Any]

Returns the whole widget config

New in version 3.18.

Return type:

Dict[str, Any]

widgetValueChanged(self, attribute: str, newValue: Any, attributeChanged: bool)

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

Forward the signal to the embedded form

Parameters:
  • attribute (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

New in version 3.14.