From 1468a821fbc0dc9d4b4892a2d2cdd45ffdaa909b Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 5 Jan 2020 22:21:55 +0100 Subject: [PATCH] Fix restoring to correct screen when maximized --- src/core/mainwindow.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 520d40135..d55a1f9c2 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -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() << 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()); }