QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
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. More... | |
void | relationsLoaded () |
This signal is emitted when the relations were loaded after reading a project. More... | |
Public Member Functions | |
QgsRelationManager (QgsProject *project=nullptr) | |
Constructor for QgsRelationManager. More... | |
void | addRelation (const QgsRelation &relation) |
Add a relation. More... | |
void | clear () |
Remove any relation managed by this class. More... | |
QList< QgsRelation > | referencedRelations (QgsVectorLayer *layer=nullptr) const |
Get all relations where this layer is the referenced part (i.e. More... | |
QList< QgsRelation > | referencingRelations (QgsVectorLayer *layer=nullptr, int fieldIdx=-2) const |
Get all relations where the specified layer (and field) is the referencing part (i.e. More... | |
QgsRelation | relation (const QString &id) const |
Get access to a relation by its id. More... | |
const QMap< QString, QgsRelation > & | relations () const |
Get access to the relations managed by this class. More... | |
QList< QgsRelation > | relationsByName (const QString &name) const |
Returns a list of relations with matching names. More... | |
void | removeRelation (const QString &id) |
Remove a relation. More... | |
void | removeRelation (const QgsRelation &relation) |
Remove a relation. More... | |
void | setRelations (const QList< QgsRelation > &relations) |
Will set the specified relations and remove any relation currently set. More... | |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
This class manages a set of relations between layers.
Definition at line 32 of file qgsrelationmanager.h.
|
explicit |
Constructor for QgsRelationManager.
project | associated project (used to notify project of changes) |
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 90 of file qgsrelationmanager.cpp.
QList< QgsRelation > QgsRelationManager::referencedRelations | ( | QgsVectorLayer * | layer = nullptr | ) | 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 133 of file qgsrelationmanager.cpp.
QList< QgsRelation > QgsRelationManager::referencingRelations | ( | QgsVectorLayer * | layer = nullptr , |
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 96 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 72 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.
QList< QgsRelation > QgsRelationManager::relationsByName | ( | const QString & | name | ) | const |
Returns a list of relations with matching names.
name | relation name to search for. Searching is case insensitive. |
Definition at line 77 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 60 of file qgsrelationmanager.cpp.
void QgsRelationManager::removeRelation | ( | const QgsRelation & | relation | ) |
Remove a relation.
relation | The relation to remove. |
Definition at line 66 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.