From fa0a9d315c8da11c0687db9af967a2fefc3c9022 Mon Sep 17 00:00:00 2001 From: Mark Furneaux Date: Sun, 22 Nov 2015 00:35:27 -0500 Subject: [PATCH] Respawn mainwindow on correct monitor PR #5081 created a regression where the mainwindow will always start on the primary monitor regardless of which one it was closed on when maximized. This restores previous functionality. --- src/ui/mainwindow.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 35f8edb42..26857966b 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -903,14 +903,13 @@ MainWindow::MainWindow(Application* app, SystemTrayIcon* tray_icon, OSD* osd, qLog(Debug) << "Loading settings"; settings_.beginGroup(kSettingsGroup); - // Set window Geometry if the window was closed in normal mode - // else set it to window maximized + // Set last used geometry to position window on the correct monitor + // Set window state only if the window was last maximized was_maximized_ = settings_.value("maximized", false).toBool(); - if (!was_maximized_) { - restoreGeometry(settings_.value("geometry").toByteArray()); - } else { + restoreGeometry(settings_.value("geometry").toByteArray()); + if (was_maximized_) { setWindowState(windowState() | Qt::WindowMaximized); - } + } if (!ui_->splitter->restoreState( settings_.value("splitter_state").toByteArray())) {