Skip to content

Commit

Permalink
Save collapsed state for relation editor widgets individually
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 1, 2015
1 parent 5d38bd1 commit b284668
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/gui/qgsrelationeditorwidget.cpp
Expand Up @@ -153,6 +153,9 @@ void QgsRelationEditorWidget::setRelationFeature( const QgsRelation& relation, c
mToggleEditingButton->setEnabled( false );
}

setObjectName( mRelation.name() );
loadState();

// If not yet initialized, it is not (yet) visible, so we don't load it to be faster (lazy loading)
// If it is already initialized, it has been set visible before and the currently shown feature is changing
// and the widget needs updating
Expand All @@ -176,6 +179,14 @@ void QgsRelationEditorWidget::setViewMode( QgsDualView::ViewMode mode )
mViewMode = mode;
}

void QgsRelationEditorWidget::setQgisRelation( QString qgisRelationId )
{
mRelationId = qgisRelationId;
// by setting the object name appropriately we can properly save the collapsed state
setObjectName( qgisRelationId );
loadState();
}

void QgsRelationEditorWidget::referencingLayerEditingToggled()
{
bool editable = false;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsrelationeditorwidget.h
Expand Up @@ -49,7 +49,7 @@ class GUI_EXPORT QgsRelationEditorWidget : public QgsCollapsibleGroupBox

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

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

0 comments on commit b284668

Please sign in to comment.