This class manages a set of relations between layers.
More...
#include <qgsrelationmanager.h>
This class manages a set of relations between layers.
Definition at line 35 of file qgsrelationmanager.h.
◆ QgsRelationManager()
QgsRelationManager::QgsRelationManager |
( |
QgsProject * |
project = nullptr | ) |
|
|
explicit |
◆ addPolymorphicRelation()
Adds a new polymorphic relation.
The generated relations are not available, they will be created automatically.
Definition at line 322 of file qgsrelationmanager.cpp.
◆ addRelation()
void QgsRelationManager::addRelation |
( |
const QgsRelation & |
relation | ) |
|
Add a relation.
Invalid relations are added only if both referencing layer and referenced layer exist.
- Parameters
-
relation | The relation to add. |
Definition at line 58 of file qgsrelationmanager.cpp.
◆ changed
void QgsRelationManager::changed |
( |
| ) |
|
|
signal |
Emitted when relations are added or removed to the manager.
- Since
- QGIS 2.5
◆ clear()
void QgsRelationManager::clear |
( |
| ) |
|
◆ context()
◆ discoverRelations()
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
- Since
- QGIS 3.0
Definition at line 292 of file qgsrelationmanager.cpp.
◆ polymorphicRelation()
◆ polymorphicRelations()
◆ referencedRelations()
Gets 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.
Definition at line 156 of file qgsrelationmanager.cpp.
◆ referencingRelations()
QList< QgsRelation > QgsRelationManager::referencingRelations |
( |
const QgsVectorLayer * |
layer = nullptr , |
|
|
int |
fieldIdx = -2 |
|
) |
| const |
Gets 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.
Definition at line 118 of file qgsrelationmanager.cpp.
◆ relation()
QgsRelation QgsRelationManager::relation |
( |
const QString & |
id | ) |
const |
◆ relations()
QMap< QString, QgsRelation > QgsRelationManager::relations |
( |
| ) |
const |
Gets access to the relations managed by this class.
- Returns
- A QMap where the key is the relation id, the value the relation object.
Definition at line 53 of file qgsrelationmanager.cpp.
◆ relationsByName()
QList< QgsRelation > QgsRelationManager::relationsByName |
( |
const QString & |
name | ) |
const |
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
- See also
- relation()
- Since
- QGIS 2.16
Definition at line 99 of file qgsrelationmanager.cpp.
◆ relationsLoaded
void QgsRelationManager::relationsLoaded |
( |
| ) |
|
|
signal |
Emitted when the relations were loaded after reading a project.
◆ removePolymorphicRelation()
void QgsRelationManager::removePolymorphicRelation |
( |
const QString & |
polymorphicRelationId | ) |
|
Removes an existing polymorphic relation and it's generated relations.
Definition at line 334 of file qgsrelationmanager.cpp.
◆ removeRelation() [1/2]
void QgsRelationManager::removeRelation |
( |
const QgsRelation & |
relation | ) |
|
◆ removeRelation() [2/2]
void QgsRelationManager::removeRelation |
( |
const QString & |
id | ) |
|
◆ setPolymorphicRelations()
Sets the specified polymorphic relations and removes any polymorphic relations currently set.
Will remove any generated relations and recreate them.
Definition at line 343 of file qgsrelationmanager.cpp.
◆ setRelations()
void QgsRelationManager::setRelations |
( |
const QList< QgsRelation > & |
relations | ) |
|
Will set the specified relations and remove any relation currently set.
- Parameters
-
relations | A list of relations to set. |
Definition at line 43 of file qgsrelationmanager.cpp.
◆ updateRelationsStatus
void QgsRelationManager::updateRelationsStatus |
( |
| ) |
|
|
slot |
The documentation for this class was generated from the following files: