QGIS API Documentation
2.8.2-Wien
|
This class manages a set of relations between layers. More...
#include <qgsrelationmanager.h>
Signals | |
void | changed () |
Emitted when relations are added or removed to the manager. | |
void | relationsLoaded () |
this signal is emitted when the relations were loaded after reading a project |
Public Member Functions | |
QgsRelationManager (QgsProject *project) | |
void | addRelation (const QgsRelation &relation) |
Add a relation. | |
void | clear () |
Remove any relation managed by this class. | |
QList< QgsRelation > | referencedRelations (QgsVectorLayer *layer=0) const |
Get all relations where this layer is the referenced part (i.e. | |
QList< QgsRelation > | referencingRelations (QgsVectorLayer *layer=0, int fieldIdx=-2) const |
Get all relations where the specified layer (and field) is the referencing part (i.e. | |
QgsRelation | relation (const QString &id) const |
Get access to a relation by its id. | |
const QMap< QString, QgsRelation > & | relations () const |
Get access to the relations managed by this class. | |
void | removeRelation (const QString &id) |
Remove a relation. | |
void | removeRelation (const QgsRelation &relation) |
Remove a relation. | |
void | setRelations (const QList< QgsRelation > &relations) |
Will set the specified relations and remove any relation currently set. |
This class manages a set of relations between layers.
Definition at line 32 of file qgsrelationmanager.h.
|
explicit |
Definition at line 24 of file qgsrelationmanager.cpp.
void QgsRelationManager::addRelation | ( | const QgsRelation & | relation | ) |
Add a relation.
relation | The relation to add. |
Definition at line 48 of file qgsrelationmanager.cpp.
|
signal |
Emitted when relations are added or removed to the manager.
void QgsRelationManager::clear | ( | ) |
Remove any relation managed by this class.
Definition at line 76 of file qgsrelationmanager.cpp.
QList< QgsRelation > QgsRelationManager::referencedRelations | ( | QgsVectorLayer * | layer = 0 | ) | const |
Get all relations where this layer is the referenced part (i.e.
the parent table with the primary key being referenced from another layer).
layer | The layer which should be searched for. |
Definition at line 119 of file qgsrelationmanager.cpp.
QList< QgsRelation > QgsRelationManager::referencingRelations | ( | QgsVectorLayer * | layer = 0 , |
int | fieldIdx = -2 |
||
) | const |
Get all relations where the specified layer (and field) is the referencing part (i.e.
the child table with the foreign key).
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. |
Definition at line 82 of file qgsrelationmanager.cpp.
QgsRelation QgsRelationManager::relation | ( | const QString & | id | ) | const |
Get access to a relation by its id.
id | The id to search for |
Definition at line 71 of file qgsrelationmanager.cpp.
const QMap< QString, QgsRelation > & QgsRelationManager::relations | ( | ) | const |
Get access to the relations managed by this class.
Definition at line 43 of file qgsrelationmanager.cpp.
|
signal |
this signal is emitted when the relations were loaded after reading a project
void QgsRelationManager::removeRelation | ( | const QString & | id | ) |
Remove a relation.
id | The id of the relation to remove. |
Definition at line 59 of file qgsrelationmanager.cpp.
void QgsRelationManager::removeRelation | ( | const QgsRelation & | relation | ) |
Remove a relation.
relation | The relation to remove. |
Definition at line 65 of file qgsrelationmanager.cpp.
void QgsRelationManager::setRelations | ( | const QList< QgsRelation > & | relations | ) |
Will set the specified relations and remove any relation currently set.
relations | A list of relations to set. |
Definition at line 33 of file qgsrelationmanager.cpp.