@@ -36,15 +36,72 @@ class CORE_EXPORT QgsRelationManager : public QObject
36
36
public:
37
37
explicit QgsRelationManager ( QgsProject *project );
38
38
39
+ /* *
40
+ * Will set the specified relations and remove any relation currently set.
41
+ *
42
+ * @param relations A list of relations to set.
43
+ */
39
44
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
+ */
40
51
const QMap<QString, QgsRelation>& relations () const ;
52
+
53
+ /* *
54
+ * Add a relation.
55
+ *
56
+ * @param The relation to add.
57
+ */
41
58
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
+ */
43
72
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
+ */
44
81
QgsRelation relation ( const QString& id ) const ;
82
+
83
+ /* *
84
+ * Remove any relation managed by this class.
85
+ */
45
86
void clear ();
46
87
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
+ */
47
96
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
+ */
48
105
QList<QgsRelation> referencedRelations ( QgsVectorLayer *layer = 0 ) const ;
49
106
50
107
signals:
0 commit comments