QGIS/python/core/qgsrelationmanager.sip

148 lines
4.2 KiB
Plaintext
Raw Normal View History

2017-05-18 16:39:21 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsrelationmanager.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2014-01-27 09:22:24 +01:00
class QgsRelationManager : QObject
{
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
This class manages a set of relations between layers.
2017-05-18 16:39:21 +02:00
%End
2014-01-27 09:22:24 +01:00
%TypeHeaderCode
#include "qgsrelationmanager.h"
%End
public:
explicit QgsRelationManager( QgsProject *project = 0 );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor for QgsRelationManager.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param project: associated project (used to notify project of changes)
2017-05-18 16:39:21 +02:00
%End
2014-01-27 09:22:24 +01:00
void setRelations( const QList<QgsRelation> &relations );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Will set the specified relations and remove any relation currently set.
2017-05-18 16:39:21 +02:00
2017-12-15 10:36:55 -04:00
:param relations: A list of relations to set.
2017-05-18 16:39:21 +02:00
%End
2015-02-03 02:21:52 +01:00
QMap<QString, QgsRelation> relations() const;
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Get access to the relations managed by this class.
:return: A QMap where the key is the relation id, the value the relation object.
2017-05-18 16:39:21 +02:00
%End
2015-02-03 02:21:52 +01:00
void addRelation( const QgsRelation &relation );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Add a relation.
2017-05-18 16:39:21 +02:00
2017-12-15 10:36:55 -04:00
:param relation: The relation to add.
2017-05-18 16:39:21 +02:00
%End
2015-02-03 02:21:52 +01:00
void removeRelation( const QString &id );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Remove a relation.
2017-05-18 16:39:21 +02:00
2017-12-15 10:36:55 -04:00
:param id: The id of the relation to remove.
2017-05-18 16:39:21 +02:00
%End
2015-02-03 02:21:52 +01:00
void removeRelation( const QgsRelation &relation );
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Remove a relation.
2017-05-18 16:39:21 +02:00
2017-12-15 10:36:55 -04:00
:param relation: The relation to remove.
2017-05-18 16:39:21 +02:00
%End
2015-02-03 02:21:52 +01:00
QgsRelation relation( const QString &id ) const;
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Get access to a relation by its id.
:param id: The id to search for
:return: A relation. Invalid if not found.
2017-05-18 16:39:21 +02:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`relationsByName()`
2017-05-18 16:39:21 +02:00
%End
2015-02-03 02:21:52 +01:00
QList<QgsRelation> relationsByName( const QString &name ) const;
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns a list of relations with matching names.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param name: relation name to search for. Searching is case insensitive.
:return: a list of matching relations
2017-05-18 16:39:21 +02:00
.. versionadded:: 2.16
2017-12-15 10:36:55 -04:00
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`relation()`
2017-05-18 16:39:21 +02:00
%End
2014-01-27 09:22:24 +01:00
void clear();
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Remove any relation managed by this class.
2017-05-18 16:39:21 +02:00
%End
2014-01-27 09:22:24 +01:00
QList<QgsRelation> referencingRelations( const QgsVectorLayer *layer = 0, int fieldIdx = -2 ) const;
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Get all relations where the specified layer (and field) is the referencing part (i.e. the child table with the foreign key).
2017-05-18 16:39:21 +02:00
2017-12-15 10:36:55 -04:00
:param layer: The layer which should be searched for.
:param fieldIdx: The field which should be part of the foreign key. If not set will return all relations.
:return: A list of relations matching the given layer and fieldIdx.
2017-05-18 16:39:21 +02:00
%End
2015-02-03 02:21:52 +01:00
2014-01-27 09:22:24 +01:00
QList<QgsRelation> referencedRelations( QgsVectorLayer *layer = 0 ) const;
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Get all relations where this layer is the referenced part (i.e. the parent table with the primary key being referenced from another layer).
:param layer: The layer which should be searched for.
2014-01-27 09:22:24 +01:00
2017-12-15 10:36:55 -04:00
:return: A list of relations where the specified layer is the referenced part.
2017-05-18 16:39:21 +02:00
%End
static QList<QgsRelation> discoverRelations( const QList<QgsRelation> &existingRelations, const QList<QgsVectorLayer *> &layers );
%Docstring
2017-12-15 10:36:55 -04:00
Discover all the relations available from the current layers.
:param existingRelations: the existing relations to filter them out
:param layers: the current layers
:return: the list of discovered relations
2017-05-18 16:39:21 +02:00
.. versionadded:: 3.0
%End
2014-01-27 09:22:24 +01:00
signals:
void relationsLoaded();
2017-05-18 16:39:21 +02:00
%Docstring
This signal is emitted when the relations were loaded after reading a project
%End
2014-11-13 23:13:13 +01:00
void changed();
2017-05-18 16:39:21 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Emitted when relations are added or removed to the manager.
2017-05-18 16:39:21 +02:00
.. versionadded:: 2.5
%End
2014-01-27 09:22:24 +01:00
};
2017-05-18 16:39:21 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsrelationmanager.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/