Navigation Menu

Skip to content

Commit

Permalink
add method to get relation in QgsAbstractRelationEditorWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jan 25, 2021
1 parent f180ef9 commit 30db6fa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Expand Up @@ -48,13 +48,20 @@ Sets the ``relation`` and the ``feature``

void setRelations( const QgsRelation &relation, const QgsRelation &nmrelation );
%Docstring
Set the relation(s) for this widget
Sets the relation(s) for this widget
If only one relation is set, it will act as a simple 1:N relation widget
If both relations are set, it will act as an N:M relation widget
inserting and deleting entries on the intermediate table as required.

:param relation: Relation referencing the edited table
:param nmrelation: Optional reference from the referencing table to a 3rd N:M table
%End

QgsRelation relation() const;
%Docstring
Returns the relation

.. versionadded:: 3.18
%End

void setFeature( const QgsFeature &feature, bool update = true );
Expand Down
8 changes: 7 additions & 1 deletion src/gui/qgsabstractrelationeditorwidget.h
Expand Up @@ -70,7 +70,7 @@ class GUI_EXPORT QgsAbstractRelationEditorWidget : public QWidget
void setRelationFeature( const QgsRelation &relation, const QgsFeature &feature );

/**
* Set the relation(s) for this widget
* Sets the relation(s) for this widget
* If only one relation is set, it will act as a simple 1:N relation widget
* If both relations are set, it will act as an N:M relation widget
* inserting and deleting entries on the intermediate table as required.
Expand All @@ -80,6 +80,12 @@ class GUI_EXPORT QgsAbstractRelationEditorWidget : public QWidget
*/
void setRelations( const QgsRelation &relation, const QgsRelation &nmrelation );

/**
* Returns the relation
* \since QGIS 3.18
*/
QgsRelation relation() const {return mRelation;}

/**
* Sets the \a feature being edited and updates the UI unless \a update is set to FALSE
*/
Expand Down

0 comments on commit 30db6fa

Please sign in to comment.