Fix restoring to correct screen when maximized
This commit is contained in:
parent
3cdc8dc4b6
commit
1468a821fb
|
@ -779,10 +779,11 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSD *osd, co
|
|||
|
||||
// Set last used geometry to position window on the correct monitor
|
||||
// Set window state only if the window was last maximized
|
||||
if (settings_.contains("geometry")) {
|
||||
restoreGeometry(settings_.value("geometry").toByteArray());
|
||||
}
|
||||
was_maximized_ = settings_.value("maximized", true).toBool();
|
||||
|
||||
if (was_maximized_) setWindowState(windowState() | Qt::WindowMaximized);
|
||||
else restoreGeometry(settings_.value("geometry").toByteArray());
|
||||
|
||||
if (!ui_->splitter->restoreState(settings_.value("splitter_state").toByteArray())) {
|
||||
ui_->splitter->setSizes(QList<int>() << 250 << width() - 250);
|
||||
|
@ -1167,10 +1168,8 @@ void MainWindow::SaveGeometry() {
|
|||
|
||||
if (!initialised_) return;
|
||||
|
||||
was_maximized_ = isMaximized();
|
||||
settings_.setValue("maximized", was_maximized_);
|
||||
if (was_maximized_) settings_.remove("geometry");
|
||||
else settings_.setValue("geometry", saveGeometry());
|
||||
settings_.setValue("maximized", isMaximized());
|
||||
settings_.setValue("geometry", saveGeometry());
|
||||
settings_.setValue("splitter_state", ui_->splitter->saveState());
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue