Skip to content

Commit b284668

Browse files
committed
Save collapsed state for relation editor widgets individually
1 parent 5d38bd1 commit b284668

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/gui/qgsrelationeditorwidget.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ void QgsRelationEditorWidget::setRelationFeature( const QgsRelation& relation, c
153153
mToggleEditingButton->setEnabled( false );
154154
}
155155

156+
setObjectName( mRelation.name() );
157+
loadState();
158+
156159
// If not yet initialized, it is not (yet) visible, so we don't load it to be faster (lazy loading)
157160
// If it is already initialized, it has been set visible before and the currently shown feature is changing
158161
// and the widget needs updating
@@ -176,6 +179,14 @@ void QgsRelationEditorWidget::setViewMode( QgsDualView::ViewMode mode )
176179
mViewMode = mode;
177180
}
178181

182+
void QgsRelationEditorWidget::setQgisRelation( QString qgisRelationId )
183+
{
184+
mRelationId = qgisRelationId;
185+
// by setting the object name appropriately we can properly save the collapsed state
186+
setObjectName( qgisRelationId );
187+
loadState();
188+
}
189+
179190
void QgsRelationEditorWidget::referencingLayerEditingToggled()
180191
{
181192
bool editable = false;

src/gui/qgsrelationeditorwidget.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox
4949

5050
//! Defines the relation ID (from project relations)
5151
//! @note use a widget's property to keep compatibility with using basic widget instead of QgsRelationEditorWidget
52-
void setQgisRelation( QString qgisRelationId ) { mRelationId = qgisRelationId; }
52+
void setQgisRelation( QString qgisRelationId );
5353
QString qgisRelation() { return mRelationId; } //property( "qgisRelation" ).toString()
5454

5555
void setRelationFeature( const QgsRelation& relation, const QgsFeature& feature );

0 commit comments

Comments
 (0)