Class: QgsRelationReferenceWidget¶
A widget which shows related features.
Class Hierarchy¶
Base classes¶
- class qgis.gui.QgsRelationReferenceWidget[source]¶
Bases:
QWidget- class CanvasExtent¶
Bases:
int
- Fixed = 0¶
- Pan = 1¶
- Scale = 2¶
- allowAddFeatures(self) bool[source]¶
Determines if a button for adding new features should be shown.
- Return type:
bool
- allowMapIdentification(self) bool[source]¶
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[source]¶
Determines if the filters are chained
- Return type:
bool
- Returns:
Trueif filters are chained
- embedForm(self) bool[source]¶
determines if the form of the related feature will be shown
- Return type:
bool
- fetchLimit(self) int[source]¶
Returns the limit of fetched features (0 means all features)
Added in version 3.32.
- Return type:
int
- foreignKey(self) Any[source]¶
returns the related feature foreign key
Deprecated since version 3.10.
- Return type:
- signal foreignKeyChanged[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- foreignKeys(self) List[Any][source]¶
Returns the related feature foreign keys
Added in version 3.10.
- signal foreignKeysChanged[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- openFormButtonVisible(self) bool[source]¶
determines the open form button is visible in the widget
- Return type:
bool
- orderExpression(self) str[source]¶
Returns the string of the order expression The order expression will be used for sort values in the combobox.
Added in version 4.0.
- Return type:
str
- referencedFeature(self) QgsFeature[source]¶
Returns the related feature (from the referenced layer) if no feature is related, it returns an invalid feature
- Return type:
- referencedLayerDataSource(self) str[source]¶
Returns the public data source of the referenced layer
Added in version 3.12.
- Return type:
str
- referencedLayerId(self) str[source]¶
Returns the id of the referenced layer
Added in version 3.12.
- Return type:
str
- referencedLayerName(self) str[source]¶
Returns the name of the referenced layer
Added in version 3.12.
- Return type:
str
- referencedLayerProviderKey(self) str[source]¶
Returns the data provider key of the referenced layer
Added in version 3.12.
- Return type:
str
- relation(self) QgsRelation[source]¶
Returns the current relation, which might be invalid
Added in version 3.10.
- Return type:
- saveReferencedAttributeForm(self) bool[source]¶
Trigger save of the embedded referenced attribute form. Returns
Trueon success or if no embedded form is present.Added in version 3.42.
- Return type:
bool
- setAllowAddFeatures(self, allowAddFeatures: bool)[source]¶
Determines if a button for adding new features should be shown.
- Parameters:
allowAddFeatures (bool)
- setAllowMapIdentification(self, allowMapIdentification: bool)[source]¶
- Parameters:
allowMapIdentification (bool)
- setChainFilters(self, chainFilters: bool)[source]¶
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 | None, messageBar: QgsMessageBar | None)[source]¶
Sets the editor
contextNote
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 (Optional[QgsMapCanvas])
messageBar (Optional[QgsMessageBar])
- setFetchLimit(self, fetchLimit: int)[source]¶
Set the limit of fetched features (0 means all features)
Added in version 3.32.
- Parameters:
fetchLimit (int)
- setFilterExpression(self, filterExpression: str | None)[source]¶
If not empty, will be used as filter expression. Only if this evaluates to
True, the value will be shown.- Parameters:
filterExpression (Optional[str])
- setFilterFields(self, filterFields: Iterable[str | None])[source]¶
Sets the fields for which filter comboboxes will be created
- Parameters:
filterFields (Iterable[Optional[str]])
- setForeignKey(self, value: Any)[source]¶
this sets the related feature using from the foreign key
Deprecated since version 3.10: Use setForeignKeys.
- Parameters:
value (Any)
- setForeignKeys(self, values: Iterable[Any])[source]¶
Sets the related feature using the foreign keys
Added in version 3.10.
- Parameters:
values (Iterable[Any])
- setFormFeature(self, formFeature: QgsFeature)[source]¶
Set the current form feature (from the referencing layer)
Added in version 3.10.
- Parameters:
formFeature (QgsFeature)
- setOpenFormButtonVisible(self, openFormButtonVisible: bool)[source]¶
- Parameters:
openFormButtonVisible (bool)
- setOrderExpression(self, orderExpression: str | None)[source]¶
Set the string of the order expression The order expression will be used for sort values in the combobox.
Added in version 4.0.
- Parameters:
orderExpression (Optional[str])
- setParentFormFeature(self, parentFormFeature: QgsFeature)[source]¶
Set the current parent form feature
Added in version 3.42.2.
- Parameters:
parentFormFeature (QgsFeature)
- setReferencedLayerDataSource(self, referencedLayerDataSource: str | None)[source]¶
Set the public data source of the referenced layer to
referencedLayerDataSourceAdded in version 3.12.
- Parameters:
referencedLayerDataSource (Optional[str])
- setReferencedLayerId(self, referencedLayerId: str | None)[source]¶
Set the id of the referenced layer to
referencedLayerIdAdded in version 3.12.
- Parameters:
referencedLayerId (Optional[str])
- setReferencedLayerName(self, referencedLayerName: str | None)[source]¶
Set the name of the referenced layer to
referencedLayerNameAdded in version 3.12.
- Parameters:
referencedLayerName (Optional[str])
- setReferencedLayerProviderKey(self, referencedLayerProviderKey: str | None)[source]¶
Set the data provider key of the referenced layer to
referencedLayerProviderKeyAdded in version 3.12.
- Parameters:
referencedLayerProviderKey (Optional[str])
- setRelation(self, relation: QgsRelation, allowNullValue: bool)[source]¶
- Parameters:
relation (QgsRelation)
allowNullValue (bool)
- setSortOrder(self, sortOrder: Qt.SortOrder)[source]¶
Set the order direction The order direction will be used for sort values in the combobox. Ascending or descending
Added in version 4.0.
- Parameters:
sortOrder (Qt.SortOrder)