Class: QgsRelationEditorWidget

class qgis.gui.QgsRelationEditorWidget(parent: QWidget = None)

Bases: QgsCollapsibleGroupBox

Parameters

parent

parent widget

Methods

actionEvent

changeEvent

childEvent

clearModifiers

closeEvent

collapseExpandFixes

Visual fixes for when group box is collapsed/expanded

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

editorContext

Returns the attribute editor context.

enterEvent

event

feature

Returns the widget's current feature

featureSelectionManager

The feature selection manager is responsible for the selected features which are currently being edited.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

forceSuppressFormPopup

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

hideEvent

init

initPainter

initStyleOption

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

label

Determines the label of this element

leaveEvent

loadState

Will load the collapsed and checked state

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

nmRelationId

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

paintEvent

parentFormValueChanged

Called when an attribute value in the parent widget has changed to newValue

receivers

resizeEvent

saveKey

saveState

Will save the collapsed and checked state

sender

senderSignalIndex

setEditorContext

Sets the editor context

setFeature

Sets the feature being edited and updates the UI unless update is set to False

setForceSuppressFormPopup

Sets force suppress form popup status with forceSuppressFormPopup configured for this widget

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.

setRelationFeature

Sets the relation and the feature

setRelations

Set the relation(s) for this widget If only one relation is set, it will act as a simple 1:N relation widget If both relations are set, it will act as an N:M relation widget inserting and deleting entries on the intermediate table as required.

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

setViewMode

Define the view mode for the dual view

setVisibleButtons

Defines the buttons which are shown

sharedPainter

showEvent

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

tabletEvent

timerEvent

titleRect

updateMicroFocus

updateStyle

viewMode

Gets the view mode for the dual view

visibleButtons

Returns the buttons which are shown

wheelEvent

actionEvent(self, QActionEvent)
changeEvent(self, event: QEvent)
childEvent(self, QChildEvent)
clearModifiers(self)
closeEvent(self, QCloseEvent)
collapseExpandFixes(self)

Visual fixes for when group box is collapsed/expanded

connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
editorContext(self) QgsAttributeEditorContext

Returns the attribute editor context.

New in version 3.14.

Return type

QgsAttributeEditorContext

enterEvent(self, QEvent)
event(self, QEvent) bool
feature(self) QgsFeature

Returns the widget’s current feature

New in version 3.14.

Return type

QgsFeature

featureSelectionManager(self) QgsIFeatureSelectionManager

The feature selection manager is responsible for the selected features which are currently being edited.

Return type

QgsIFeatureSelectionManager

focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
forceSuppressFormPopup(self) bool

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

New in version 3.16.

Return type

bool

hideEvent(self, QHideEvent)
init(self)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionGroupBox)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
label(self) str

Determines the label of this element

New in version 3.16.

Return type

str

leaveEvent(self, QEvent)
loadState(self)

Will load the collapsed and checked state

The configuration path from which it is loaded is defined by

  • The object name

  • The settingGroup

metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, event: QMouseEvent)
mouseReleaseEvent(self, event: QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int]
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

paintEvent(self, QPaintEvent)
parentFormValueChanged(self, attribute: str, newValue: Any)

Called when an attribute value in the parent widget has changed to newValue

New in version 3.14.

Parameters
  • attribute (str) –

  • newValue (Any) –

receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
saveKey(self) str
saveState(self)

Will save the collapsed and checked state

The configuration path to which it is saved is defined by

  • The object name

  • The settingGroup

sender(self) QObject
senderSignalIndex(self) int
setEditorContext(self, context: QgsAttributeEditorContext)

Sets the editor context

Note

if context cadDockWidget is null, it won’t be possible to digitize the geometry of a referencing feature from this widget

Parameters

context (QgsAttributeEditorContext) –

setFeature(self, feature: QgsFeature, update: bool = True)

Sets the feature being edited and updates the UI unless update is set to False

Parameters
  • feature (QgsFeature) –

  • update (bool = True) –

setForceSuppressFormPopup(self, forceSuppressFormPopup: bool)

Sets force suppress form popup status with forceSuppressFormPopup configured for this widget

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) –

setRelationFeature(self, relation: QgsRelation, feature: QgsFeature)

Sets the relation and the feature

Parameters
setRelations(self, relation: QgsRelation, nmrelation: QgsRelation)

Set the relation(s) for this widget If only one relation is set, it will act as a simple 1:N relation widget If both relations are set, it will act as an N:M relation widget inserting and deleting entries on the intermediate table as required.

Parameters
  • relation (QgsRelation) – Relation referencing the edited table

  • nmrelation (QgsRelation) – Optional reference from the referencing table to a 3rd N:M table

setShowLabel(self, showLabel: bool)

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

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) –

setViewMode(self, mode: QgsDualView.ViewMode)

Define the view mode for the dual view

Parameters

mode (QgsDualView.ViewMode) –

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

Defines the buttons which are shown

New in version 3.16.

Parameters

buttons (Union[QgsAttributeEditorRelation.Buttons) –

sharedPainter(self) QPainter
showEvent(self, event: QShowEvent)
showLabel(self) bool

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

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

tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
titleRect(self) QRect
updateMicroFocus(self)
updateStyle(self)
viewMode(self) QgsDualView.ViewMode

Gets the view mode for the dual view

Return type

QgsDualView.ViewMode

visibleButtons(self) QgsAttributeEditorRelation.Buttons

Returns the buttons which are shown

New in version 3.16.

Return type

QgsAttributeEditorRelation.Buttons

wheelEvent(self, QWheelEvent)