From 4c665be05f7128a5a259fb3b71f3d65019639b1d Mon Sep 17 00:00:00 2001 From: Amit Chaudhuri Date: Sun, 28 Apr 2013 10:05:37 +0100 Subject: Save and retore splitter dimensions. Rename splitters and remove seemingly redundant empty splitter. Use save/restoreState to save splitter sizes using QSettings. Signed-off-by: Amit Chaudhuri Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 9 +++++++-- qt-ui/mainwindow.ui | 13 +++---------- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index c1e15e30c..71ba70525 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -289,9 +289,12 @@ void MainWindow::readSettings() { QSettings settings("hohndel.org","subsurface"); - /* note: section/key i.e. forward slash to separate */ - QSize sz = settings.value("MainWindow/size").value(); + settings.beginGroup("MainWindow"); + QSize sz = settings.value("size").value(); resize(sz); + ui->mainSplitter->restoreState(settings.value("mainSplitter").toByteArray()); + ui->infoProfileSplitter->restoreState(settings.value("infoProfileSplitter").toByteArray()); + settings.endGroup(); } void MainWindow::writeSettings() @@ -299,6 +302,8 @@ void MainWindow::writeSettings() QSettings settings("hohndel.org","subsurface"); settings.beginGroup("MainWindow"); settings.setValue("size",size()); + settings.setValue("mainSplitter", ui->mainSplitter->saveState()); + settings.setValue("infoProfileSplitter", ui->infoProfileSplitter->saveState()); settings.endGroup(); /* other groups here; avoid '/' and '\' in keys with setValue(...) please */ } diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index 3d3f0ec35..073476918 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -16,11 +16,11 @@ - + Qt::Vertical - + Qt::Horizontal @@ -34,13 +34,6 @@ - - - - Qt::Horizontal - - - @@ -49,7 +42,7 @@ 0 0 763 - 25 + 20 -- cgit v1.2.3-70-g09d2