mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Fix main window size, position, and state
Now size, position and state should be preserved correctly. Signed-off-by: glerch <guido.lerch@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
65dbfd75e0
commit
67c306b527
1 changed files with 9 additions and 7 deletions
|
@ -1085,11 +1085,12 @@ void MainWindow::initialUiSetup()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.beginGroup("MainWindow");
|
settings.beginGroup("MainWindow");
|
||||||
QSize sz = settings.value("size", qApp->desktop()->size()).value<QSize>();
|
if (settings.value("maximized", isMaximized()).value<bool>()) {
|
||||||
if (settings.value("maximized", isMaximized()).value<bool>())
|
|
||||||
showMaximized();
|
showMaximized();
|
||||||
else
|
} else {
|
||||||
resize(sz);
|
restoreGeometry(settings.value("geometry").toByteArray());
|
||||||
|
restoreState(settings.value("windowState", 0).toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
state = (CurrentState)settings.value("lastState", 0).toInt();
|
state = (CurrentState)settings.value("lastState", 0).toInt();
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
@ -1110,6 +1111,7 @@ void MainWindow::initialUiSetup()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getSetting(QSettings &s, QString name)
|
const char *getSetting(QSettings &s, QString name)
|
||||||
|
@ -1203,10 +1205,10 @@ void MainWindow::writeSettings()
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
settings.beginGroup("MainWindow");
|
settings.beginGroup("MainWindow");
|
||||||
settings.setValue("lastState", (int)state);
|
settings.setValue("geometry", saveGeometry());
|
||||||
|
settings.setValue("windowState", saveState());
|
||||||
settings.setValue("maximized", isMaximized());
|
settings.setValue("maximized", isMaximized());
|
||||||
if (!isMaximized())
|
settings.setValue("lastState", (int)state);
|
||||||
settings.setValue("size", size());
|
|
||||||
if (state == VIEWALL)
|
if (state == VIEWALL)
|
||||||
saveSplitterSizes();
|
saveSplitterSizes();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
Loading…
Reference in a new issue