@@ -34,6 +34,15 @@ class QgsAttributes;
3434 */
3535class CORE_EXPORT QgsRelation
3636{
37+ Q_GADGET
38+
39+ Q_PROPERTY ( QString id READ id WRITE setId )
40+ Q_PROPERTY ( QgsVectorLayer* referencingLayer READ referencingLayer )
41+ Q_PROPERTY ( QgsVectorLayer* referencedLayer READ referencedLayer )
42+ Q_PROPERTY ( QString name READ name WRITE setName )
43+ Q_PROPERTY ( bool isValid READ isValid )
44+
45+
3746 public:
3847
3948 /* *
@@ -87,29 +96,21 @@ class CORE_EXPORT QgsRelation
8796
8897 /* *
8998 * Set an id for this relation
90- *
91- * @param id
9299 */
93- void setRelationId ( const QString& id );
100+ void setId ( const QString& id );
94101
95102 /* *
96103 * Set a name for this relation
97- *
98- * @param name
99104 */
100- void setRelationName ( const QString& name );
105+ void setName ( const QString& name );
101106
102107 /* *
103108 * Set the referencing (child) layer id. This layer will be searched in the registry.
104- *
105- * @param id
106109 */
107110 void setReferencingLayer ( const QString& id );
108111
109112 /* *
110113 * Set the referenced (parent) layer id. This layer will be searched in the registry.
111- *
112- * @param id
113114 */
114115 void setReferencedLayer ( const QString& id );
115116
@@ -291,15 +292,28 @@ class CORE_EXPORT QgsRelation
291292 */
292293 bool hasEqualDefinition ( const QgsRelation& other ) const ;
293294
294- protected:
295+ /* *
296+ * Get the referenced field counterpart given a referencing field.
297+ *
298+ * @note Added in QGIS 3.0
299+ */
300+ Q_INVOKABLE QString resolveReferencedField ( const QString& referencingField ) const ;
301+
302+ /* *
303+ * Get the referencing field counterpart given a referenced field.
304+ *
305+ * @note Added in QGIS 3.0
306+ */
307+ Q_INVOKABLE QString resolveReferencingField ( const QString& referencedField ) const ;
308+
309+ private:
295310
296311 /* *
297312 * Updates the validity status of this relation.
298313 * Will be called internally whenever a member is changed.
299314 */
300315 void updateRelationStatus ();
301316
302- private:
303317 // ! Unique Id
304318 QString mRelationId ;
305319 // ! Human redable name
0 commit comments