@@ -36,15 +36,72 @@ class CORE_EXPORT QgsRelationManager : public QObject
3636 public:
3737 explicit QgsRelationManager ( QgsProject *project );
3838
39+ /* *
40+ * Will set the specified relations and remove any relation currently set.
41+ *
42+ * @param relations A list of relations to set.
43+ */
3944 void setRelations ( const QList<QgsRelation>& relations );
45+
46+ /* *
47+ * Get access to the relations managed by this class.
48+ *
49+ * @return A QMap where the key is the relation id, the value the relation object.
50+ */
4051 const QMap<QString, QgsRelation>& relations () const ;
52+
53+ /* *
54+ * Add a relation.
55+ *
56+ * @param The relation to add.
57+ */
4158 void addRelation ( const QgsRelation& relation );
42- void removeRelation ( const QString& name );
59+
60+ /* *
61+ * Remove a relation.
62+ *
63+ * @param id The id of the relation to remove.
64+ */
65+ void removeRelation ( const QString& id );
66+
67+ /* *
68+ * Remove a relation.
69+ *
70+ * @param relation The relation to remove.
71+ */
4372 void removeRelation ( const QgsRelation& relation );
73+
74+ /* *
75+ * Get access to a relation by its id.
76+ *
77+ * @param id The id to search for
78+ *
79+ * @return A relation. Invalid if not found.
80+ */
4481 QgsRelation relation ( const QString& id ) const ;
82+
83+ /* *
84+ * Remove any relation managed by this class.
85+ */
4586 void clear ();
4687
88+ /* *
89+ * Get all relations where the specified layer (and field) is the referencing part (i.e. the child table with the foreign key).
90+ *
91+ * @param layer The layer which should be searched for.
92+ * @param fieldIdx The field which should be part of the foreign key. If not set will return all relations.
93+ *
94+ * @return A list of relations matching the given layer and fieldIdx.
95+ */
4796 QList<QgsRelation> referencingRelations ( QgsVectorLayer *layer = 0 , int fieldIdx = -2 ) const ;
97+
98+ /* *
99+ * Get all relations where this layer is the referenced part (i.e. the parent table with the primary key being referenced from another layer).
100+ *
101+ * @param layer The layer which should be searched for.
102+ *
103+ * @return A list of relations where the specified layer is the referenced part.
104+ */
48105 QList<QgsRelation> referencedRelations ( QgsVectorLayer *layer = 0 ) const ;
49106
50107 signals:
0 commit comments