Subgroup: Relation
Class: QgsRelationManager¶
-
class
qgis.core.
QgsRelationManager
¶ Bases:
PyQt5.QtCore.QObject
This class manages a set of relations between layers.
Methods
addRelation
Add a relation. blockSignals
childEvent
children
clear
Remove any relation managed by this class. connectNotify
customEvent
deleteLater
disconnect
disconnectNotify
discoverRelations
Discover all the relations available from the current layers. dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
metaObject
moveToThread
objectName
parent
property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. receivers
referencedRelations
Get all relations where this layer is the referenced part (i.e. referencingRelations
Get all relations where the specified layer (and field) is the referencing part (i.e. relation
Get access to a relation by its id. relations
Get access to the relations managed by this class. relationsByName
Returns a list of relations with matching names. removeEventFilter
removeRelation
Remove a relation. sender
senderSignalIndex
setObjectName
setParent
setProperty
setRelations
Will set the specified relations and remove any relation currently set. signalsBlocked
startTimer
thread
timerEvent
tr
Attributes
changed
Emitted when relations are added or removed to the manager. destroyed
destroyed(self, QObject = None) [signal] objectNameChanged
objectNameChanged(self, str) [signal] relationsLoaded
This signal is emitted when the relations were loaded after reading a project [signal] staticMetaObject
-
addRelation
(self, relation: QgsRelation)¶ Add a relation.
Parameters: relation – The relation to add.
-
changed
¶ Emitted when relations are added or removed to the manager.
New in version 2.5: [signal]
-
childEvent
()¶
-
clear
(self)¶ Remove any relation managed by this class.
-
connectNotify
()¶
-
customEvent
()¶
-
disconnectNotify
()¶
-
discoverRelations
(existingRelations: Iterable[QgsRelation], layers: Iterable[QgsVectorLayer]) → List[QgsRelation]¶ Discover all the relations available from the current layers.
Parameters: - existingRelations – the existing relations to filter them out
- layers – the current layers
Returns: the list of discovered relations
New in version 3.0.
-
isSignalConnected
()¶
-
receivers
()¶
-
referencedRelations
(self, layer: QgsVectorLayer = None) → List[QgsRelation]¶ Get all relations where this layer is the referenced part (i.e. the parent table with the primary key being referenced from another layer).
Parameters: layer – The layer which should be searched for. Returns: A list of relations where the specified layer is the referenced part.
-
referencingRelations
(self, layer: QgsVectorLayer = None, fieldIdx: int = -2) → List[QgsRelation]¶ Get all relations where the specified layer (and field) is the referencing part (i.e. the child table with the foreign key).
Parameters: - layer – The layer which should be searched for.
- fieldIdx – The field which should be part of the foreign key. If not set will return all relations.
Returns: A list of relations matching the given layer and fieldIdx.
-
relation
(self, id: str) → QgsRelation¶ Get access to a relation by its id.
Parameters: id – The id to search for Returns: A relation. Invalid if not found. See also
-
relations
(self) → object¶ Get access to the relations managed by this class.
Returns: A QMap where the key is the relation id, the value the relation object.
-
relationsByName
(self, name: str) → List[QgsRelation]¶ Returns a list of relations with matching names.
Parameters: name – relation name to search for. Searching is case insensitive. Returns: a list of matching relations New in version 2.16.
See also
-
relationsLoaded
¶ This signal is emitted when the relations were loaded after reading a project [signal]
-
removeRelation
(self, id: str)¶ Remove a relation.
Parameters: id – The id of the relation to remove. removeRelation(self, relation: QgsRelation) Remove a relation.
Parameters: relation – The relation to remove.
-
sender
()¶
-
senderSignalIndex
()¶
-
setRelations
(self, relations: Iterable[QgsRelation])¶ Will set the specified relations and remove any relation currently set.
Parameters: relations – A list of relations to set.
-
timerEvent
()¶
-