Class: QgsRelationReferenceWidget

class qgis.gui.QgsRelationReferenceWidget(parent: QWidget)

Bases: PyQt5.QtWidgets.QWidget

Methods

actionEvent

allowAddFeatures

Determines if a button for adding new features should be shown.

allowMapIdentification

determines if the widget offers the possibility to select the related feature on the map (using a dedicated map tool)

chainFilters

Determines if the filters are chained

changeEvent

childEvent

closeEvent

connectNotify

contextMenuEvent

create

customEvent

deleteForeignKeys

unset the currently related feature

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

embedForm

determines if the form of the related feature will be shown

enterEvent

event

filterExpression

Returns the currently set filter expression.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

foreignKey

returns the related feature foreign key

foreignKeys

Returns the related feature foreign keys

hideEvent

init

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

mapIdentification

activate the map tool to select a new related feature on the map

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

openForm

open the form of the related feature in a new dialog

openFormButtonVisible

determines the open form button is visible in the widget

orderByValue

If the widget will order the combobox entries by value

paintEvent

readOnlySelector

determines if the drop-down is enabled

receivers

referencedFeature

Returns the related feature (from the referenced layer) if no feature is related, it returns an invalid feature

referencedLayerDataSource

Returns the public data source of the referenced layer

referencedLayerId

Returns the id of the referenced layer

referencedLayerName

Returns the name of the referenced layer

referencedLayerProviderKey

Returns the data provider key of the referenced layer

relation

Returns the current relation, which might be invalid

resizeEvent

sender

senderSignalIndex

setAllowAddFeatures

Determines if a button for adding new features should be shown.

setAllowMapIdentification

param allowMapIdentification

setChainFilters

Set if filters are chained.

setEditorContext

Sets the editor context

setEmbedForm

param display

setFilterExpression

If not empty, will be used as filter expression.

setFilterFields

Sets the fields for which filter comboboxes will be created

setForeignKey

this sets the related feature using from the foreign key

setForeignKeys

Sets the related feature using the foreign keys

setFormFeature

Set the current form feature (from the referencing layer)

setOpenFormButtonVisible

param openFormButtonVisible

setOrderByValue

Sets if the widget will order the combobox entries by value

setReadOnlySelector

param readOnly

setReferencedLayerDataSource

Set the public data source of the referenced layer to referencedLayerDataSource

setReferencedLayerId

Set the id of the referenced layer to referencedLayerId

setReferencedLayerName

Set the name of the referenced layer to referencedLayerName

setReferencedLayerProviderKey

Set the data provider key of the referenced layer to referencedLayerProviderKey

setRelation

param relation

setRelationEditable

param editable

sharedPainter

showEvent

param e

showIndeterminateState

Sets the widget to display in an indeterminate “mixed value” state.

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

foreignKeyChanged

Emitted when the foreign key changed

foreignKeysChanged

Emitted when the foreign keys changed

Attributes

Fixed

Pan

Scale

class CanvasExtent

Bases: int

Fixed = 0
Pan = 1
Scale = 2
actionEvent(self, QActionEvent)
allowAddFeatures(self)bool

Determines if a button for adding new features should be shown.

New in version 2.16.

Return type

bool

allowMapIdentification(self)bool

determines if the widget offers the possibility to select the related feature on the map (using a dedicated map tool)

Return type

bool

chainFilters(self)bool

Determines if the filters are chained

Return type

bool

Returns

True if filters are chained

changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
deleteForeignKeys(self)

unset the currently related feature

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

determines if the form of the related feature will be shown

Return type

bool

enterEvent(self, QEvent)
event(self, QEvent)bool
filterExpression(self)str

Returns the currently set filter expression.

Return type

str

focusInEvent(self, QFocusEvent)
focusNextChild(self)bool
focusNextPrevChild(self, bool)bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self)bool
foreignKey(self)Any

returns the related feature foreign key

Deprecated since version QGIS: 3.10

Return type

Any

foreignKeyChanged

Emitted when the foreign key changed

Deprecated since version QGIS: 3.10 [signal]

foreignKeys(self)List[Any]

Returns the related feature foreign keys

New in version 3.10.

Return type

List[Any]

foreignKeysChanged

Emitted when the foreign keys changed

New in version 3.10: [signal]

hideEvent(self, QHideEvent)
init(self)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod)bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
mapIdentification(self)

activate the map tool to select a new related feature on the map

metric(self, QPaintDevice.PaintDeviceMetric)int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr)Tuple[bool, int]
openForm(self)

open the form of the related feature in a new dialog

openFormButtonVisible(self)bool

determines the open form button is visible in the widget

Return type

bool

orderByValue(self)bool

If the widget will order the combobox entries by value

Return type

bool

paintEvent(self, QPaintEvent)
readOnlySelector(self)bool

determines if the drop-down is enabled

Return type

bool

receivers(self, PYQT_SIGNAL)int
referencedFeature(self)QgsFeature

Returns the related feature (from the referenced layer) if no feature is related, it returns an invalid feature

Return type

QgsFeature

referencedLayerDataSource(self)str

Returns the public data source of the referenced layer

New in version 3.12.

Return type

str

referencedLayerId(self)str

Returns the id of the referenced layer

New in version 3.12.

Return type

str

referencedLayerName(self)str

Returns the name of the referenced layer

New in version 3.12.

Return type

str

referencedLayerProviderKey(self)str

Returns the data provider key of the referenced layer

New in version 3.12.

Return type

str

relation(self)QgsRelation

Returns the current relation, which might be invalid

New in version 3.10.

Return type

QgsRelation

resizeEvent(self, QResizeEvent)
sender(self)QObject
senderSignalIndex(self)int
setAllowAddFeatures(self, allowAddFeatures: bool)

Determines if a button for adding new features should be shown.

New in version 2.16.

Parameters

allowAddFeatures (bool) –

setAllowMapIdentification(self, allowMapIdentification: bool)
Parameters

allowMapIdentification (bool) –

setChainFilters(self, chainFilters: bool)

Set if filters are chained. Chained filters restrict the option of subsequent filters based on the selection of a previous filter.

Parameters

chainFilters (bool) – If chaining should be enabled

setEditorContext(self, context: QgsAttributeEditorContext, canvas: QgsMapCanvas, messageBar: QgsMessageBar)

Sets the editor context

Note

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

Parameters
setEmbedForm(self, display: bool)
Parameters

display (bool) –

setFilterExpression(self, filterExpression: str)

If not empty, will be used as filter expression. Only if this evaluates to True, the value will be shown.

Parameters

filterExpression (str) –

setFilterFields(self, filterFields: Iterable[str])

Sets the fields for which filter comboboxes will be created

Parameters

filterFields (Iterable[str]) –

setForeignKey(self, value: Any)

this sets the related feature using from the foreign key

Deprecated since version QGIS: 3.10 use setForeignKeys

Parameters

value (Any) –

setForeignKeys(self, values: Iterable[Any])

Sets the related feature using the foreign keys

New in version 3.10.

Parameters

values (Iterable[Any]) –

setFormFeature(self, formFeature: QgsFeature)

Set the current form feature (from the referencing layer)

New in version 3.10.

Parameters

formFeature (QgsFeature) –

setOpenFormButtonVisible(self, openFormButtonVisible: bool)
Parameters

openFormButtonVisible (bool) –

setOrderByValue(self, orderByValue: bool)

Sets if the widget will order the combobox entries by value

Parameters

orderByValue (bool) –

setReadOnlySelector(self, readOnly: bool)
Parameters

readOnly (bool) –

setReferencedLayerDataSource(self, referencedLayerDataSource: str)

Set the public data source of the referenced layer to referencedLayerDataSource

New in version 3.12.

Parameters

referencedLayerDataSource (str) –

setReferencedLayerId(self, referencedLayerId: str)

Set the id of the referenced layer to referencedLayerId

New in version 3.12.

Parameters

referencedLayerId (str) –

setReferencedLayerName(self, referencedLayerName: str)

Set the name of the referenced layer to referencedLayerName

New in version 3.12.

Parameters

referencedLayerName (str) –

setReferencedLayerProviderKey(self, referencedLayerProviderKey: str)

Set the data provider key of the referenced layer to referencedLayerProviderKey

New in version 3.12.

Parameters

referencedLayerProviderKey (str) –

setRelation(self, relation: QgsRelation, allowNullValue: bool)
Parameters
setRelationEditable(self, editable: bool)
Parameters

editable (bool) –

sharedPainter(self)QPainter
showEvent(self, e: QShowEvent)
Parameters

e (QShowEvent) –

showIndeterminateState(self)

Sets the widget to display in an indeterminate “mixed value” state.

New in version 2.16.

tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)