aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2013-12-02 12:32:27 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-02 08:47:23 -0800
commitbbc022ba181b446011427235ae19a50d743c7cc7 (patch)
treef3e1bf4e5c486d7abeda18022eca8c799a3fc35b /qt-ui/mainwindow.cpp
parent627b35117414f6540dd75084dd2116896c74fae6 (diff)
downloadsubsurface-bbc022ba181b446011427235ae19a50d743c7cc7.tar.gz
MainWindow: store the window maximized state
We add the "maximized" entry for the settings group "MainWindow", and store it on close, so that the window state is the same on the next run. But then also, we only store the window size and resize to that size if not maximized. This attempts to preserve a "restored" window size. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 67ec07e75..4929dd932 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -594,7 +594,10 @@ void MainWindow::initialUiSetup()
QSettings settings;
settings.beginGroup("MainWindow");
QSize sz = settings.value("size", qApp->desktop()->size()).value<QSize>();
- resize(sz);
+ if (settings.value("maximized", isMaximized()).value<bool>())
+ showMaximized();
+ else
+ resize(sz);
state = (CurrentState) settings.value("lastState", 0).toInt();
switch(state){
@@ -670,7 +673,9 @@ void MainWindow::writeSettings()
settings.beginGroup("MainWindow");
settings.setValue("lastState", (int) state);
- settings.setValue("size",size());
+ settings.setValue("maximized", isMaximized());
+ if (!isMaximized())
+ settings.setValue("size", size());
if (state == VIEWALL){
saveSplitterSizes();
}