Class: QgsRelationWidgetWrapper

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

Bases: QgsWidgetWrapper

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

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

widgetValueChanged

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

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.

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
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.

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.

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: Union[QgsAttributeEditorRelation.Buttons, QgsAttributeEditorRelation.Button])

Defines the buttons which are shown

New in version 3.16.

Parameters

buttons (Union[QgsAttributeEditorRelation.Buttons) –

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.

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.

Return type

QgsAttributeEditorRelation.Buttons

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.