Navigation Menu

Skip to content

Commit

Permalink
Remember history dialog splitter state
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 26, 2023
1 parent 953e3de commit ddef849
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/gui/history/qgshistorywidget.cpp
Expand Up @@ -17,6 +17,7 @@
#include "qgsgui.h"
#include "qgshistoryentrymodel.h"
#include "qgshistoryentrynode.h"
#include "qgssettings.h"

#include <QTextBrowser>
#include <QtGlobal>
Expand Down Expand Up @@ -46,6 +47,15 @@ QgsHistoryWidget::QgsHistoryWidget( const QString &providerId, Qgis::HistoryProv
// expand first group (usually most recent date group)
const QModelIndex firstGroup = mProxyModel->index( 0, 0, QModelIndex() );
mTreeView->expand( firstGroup );

QgsSettings settings;
mSplitter->restoreState( settings.value( QStringLiteral( "history/splitterState%1" ).arg( providerId ) ).toByteArray() );

connect( mSplitter, &QSplitter::splitterMoved, this, [providerId, this]
{
QgsSettings settings;
settings.setValue( QStringLiteral( "history/splitterState%1" ).arg( providerId ), mSplitter->saveState() );
} );
}

void QgsHistoryWidget::currentItemChanged( const QModelIndex &selected, const QModelIndex & )
Expand Down
4 changes: 2 additions & 2 deletions src/ui/qgshistorywidgetbase.ui
Expand Up @@ -27,11 +27,11 @@
<number>0</number>
</property>
<item>
<widget class="QSplitter" name="splitter">
<widget class="QSplitter" name="mSplitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
Expand Down

0 comments on commit ddef849

Please sign in to comment.