Class: QgsRelationReferenceWidget¶
- class qgis.gui.QgsRelationReferenceWidget(parent: QWidget)¶
Bases:
PyQt5.QtWidgets.QWidget
Methods
Determines if a button for adding new features should be shown.
determines if the widget offers the possibility to select the related feature on the map (using a dedicated map tool)
Determines if the filters are chained
unset the currently related feature
determines if the form of the related feature will be shown
Returns the currently set filter expression.
returns the related feature foreign key
Returns the related feature foreign keys
activate the map tool to select a new related feature on the map
open the form of the related feature in a new dialog
determines the open form button is visible in the widget
If the widget will order the combobox entries by value
determines if the drop-down is enabled
Returns the related feature (from the referenced layer) if no feature is related, it returns an invalid feature
Returns the public data source of the referenced layer
Returns the id of the referenced layer
Returns the name of the referenced layer
Returns the data provider key of the referenced layer
Returns the current relation, which might be invalid
Determines if a button for adding new features should be shown.
- param allowMapIdentification
Set if filters are chained.
Sets the editor
context
- param display
If not empty, will be used as filter expression.
Sets the fields for which filter comboboxes will be created
this sets the related feature using from the foreign key
Sets the related feature using the foreign keys
Set the current form feature (from the referencing layer)
- param openFormButtonVisible
Sets if the widget will order the combobox entries by value
- param readOnly
Set the public data source of the referenced layer to
referencedLayerDataSource
Set the id of the referenced layer to
referencedLayerId
Set the name of the referenced layer to
referencedLayerName
Set the data provider key of the referenced layer to
referencedLayerProviderKey
- param relation
- param editable
- param e
Sets the widget to display in an indeterminate "mixed value" state.
Signals
Emitted when the foreign key changed
Emitted when the foreign keys changed
Attributes
- 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
- 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
- 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
context (QgsAttributeEditorContext) –
canvas (QgsMapCanvas) –
messageBar (QgsMessageBar) –
- 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
relation (QgsRelation) –
allowNullValue (bool) –
- setRelationEditable(self, editable: bool)¶
- Parameters
editable (bool) –
- 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)¶