Class: QgsRelationEditorWidget

class qgis.gui.QgsRelationEditorWidget

Bases: QgsAbstractRelationEditorWidget

The default relation widget in QGIS.

Added in version 3.18.

QgsRelationEditorWidget(config: Dict[str, Any], parent: Optional[QWidget] = None) Constructor

AddChildFeature = 16
AllButtons = 254
class Button

Bases: int


alias of QgsRelationEditorWidget

class Buttons
class Buttons(f: QgsRelationEditorWidget.Buttons | QgsRelationEditorWidget.Button)
class Buttons(a0: QgsRelationEditorWidget.Buttons)

Bases: sip.wrapper


alias of QgsRelationEditorWidget

DeleteChildFeature = 64
DuplicateChildFeature = 32
NoButton = 0
SaveChildEdits = 8
ZoomToChildFeature = 128
actionEvent(self, a0: QActionEvent | None)
addFeature(self, geometry: QgsGeometry = QgsGeometry()) Any

Adds new features with given geometry

Added in version 3.24.

beforeSetRelationFeature(self, newRelation: QgsRelation, newFeature: QgsFeature)
beforeSetRelations(self, newRelation: QgsRelation, newNmRelation: QgsRelation)
changeEvent(self, a0: QEvent | None)
childEvent(self, a0: QChildEvent | None)
closeEvent(self, a0: QCloseEvent | None)
config(self) Dict[str, Any]

Returns the current configuration

Return type:

Dict[str, Any]

connectNotify(self, signal: QMetaMethod)
contextMenuEvent(self, a0: QContextMenuEvent | None)
create(self, window: PyQt5.sip.voidptr = None, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, a0: QEvent | None)
deleteFeature(self, fid: int = int())

Delete a feature with given fid

deleteFeatures(self, fids: Any)

Deletes the features with fids


Deletes the currently selected features

destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, signal: QMetaMethod)
dragEnterEvent(self, a0: QDragEnterEvent | None)
dragLeaveEvent(self, a0: QDragLeaveEvent | None)
dragMoveEvent(self, a0: QDragMoveEvent | None)
dropEvent(self, a0: QDropEvent | None)

Duplicates a feature

Deprecated since version QGIS: 3.18 use duplicateSelectedFeatures() instead

duplicateFeatures(self, fids: Any)

Duplicates features


Duplicates the selected features

Added in version 3.18.

enterEvent(self, a0: QEvent | None)
event(self, a0: QEvent | None) bool
featureSelectionManager(self) QgsIFeatureSelectionManager | None

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

Return type:


focusInEvent(self, a0: QFocusEvent | None)
focusNextChild(self) bool
focusNextPrevChild(self, next: bool) bool
focusOutEvent(self, a0: QFocusEvent | None)
focusPreviousChild(self) bool
hideEvent(self, a0: QHideEvent | None)
initPainter(self, painter: QPainter | None)
inputMethodEvent(self, a0: QInputMethodEvent | None)
isSignalConnected(self, signal: QMetaMethod) bool
keyPressEvent(self, a0: QKeyEvent | None)
keyReleaseEvent(self, a0: QKeyEvent | None)
leaveEvent(self, a0: QEvent | None)

Links a new feature to the relation

metric(self, a0: QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, a0: QMouseEvent | None)
mouseMoveEvent(self, a0: QMouseEvent | None)
mousePressEvent(self, a0: QMouseEvent | None)
mouseReleaseEvent(self, a0: QMouseEvent | None)
moveEvent(self, a0: QMoveEvent | None)
nativeEvent(self, eventType: QByteArray | bytes | bytearray, message: PyQt5.sip.voidptr | None)

Called when the link feature dialog is confirmed by the user

paintEvent(self, a0: QPaintEvent | None)
parentFormValueChanged(self, attribute: str | None, newValue: Any)
  • attribute (Optional[str])

  • newValue (Any)

receivers(self, signal: PYQT_SIGNAL) int
resizeEvent(self, a0: QResizeEvent | None)

Saves the current modifications in the relation

sender(self) QObject | None
senderSignalIndex(self) int
setConfig(self, config: Dict[str, Any])

Defines the current configuration


config (Dict[str)

setEditorContext(self, context: QgsAttributeEditorContext)

Sets the editor context


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


context (QgsAttributeEditorContext)

setTitle(self, title: str | None)

Sets the title of the widget, if it is wrapped within a QgsCollapsibleGroupBox

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

setViewMode(self, mode: QgsDualView.ViewMode)

Define the view mode for the dual view


mode (QgsDualView.ViewMode)

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

Defines the buttons which are shown


buttons (Union[QgsRelationEditorWidget.Buttons)

sharedPainter(self) QPainter | None
showEvent(self, a0: QShowEvent | None)

Refresh the UI when the widget becomes visible

tabletEvent(self, a0: QTabletEvent | None)
timerEvent(self, a0: QTimerEvent | None)
toggleEditing(self, state: bool)

Toggles editing state of the widget

unlinkFeature(self, fid: int = int())

Unlinks a feature with given fid

unlinkFeatures(self, fids: Any)

Unlinks the features with fids


Unlinks the selected features from the relation


Updates the title contents to reflect the current state of the widget

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

viewMode(self) QgsDualView.ViewMode

Gets the view mode for the dual view

Return type:


visibleButtons(self) QgsRelationEditorWidget.Buttons

Returns the buttons which are shown

Return type:


wheelEvent(self, a0: QWheelEvent | None)

Zooms to the selected features