mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
627b351174
commit
bbc022ba18
1 changed files with 7 additions and 2 deletions
|
@ -594,7 +594,10 @@ void MainWindow::initialUiSetup()
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("MainWindow");
|
settings.beginGroup("MainWindow");
|
||||||
QSize sz = settings.value("size", qApp->desktop()->size()).value<QSize>();
|
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();
|
state = (CurrentState) settings.value("lastState", 0).toInt();
|
||||||
switch(state){
|
switch(state){
|
||||||
|
@ -670,7 +673,9 @@ void MainWindow::writeSettings()
|
||||||
|
|
||||||
settings.beginGroup("MainWindow");
|
settings.beginGroup("MainWindow");
|
||||||
settings.setValue("lastState", (int) state);
|
settings.setValue("lastState", (int) state);
|
||||||
settings.setValue("size",size());
|
settings.setValue("maximized", isMaximized());
|
||||||
|
if (!isMaximized())
|
||||||
|
settings.setValue("size", size());
|
||||||
if (state == VIEWALL){
|
if (state == VIEWALL){
|
||||||
saveSplitterSizes();
|
saveSplitterSizes();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue