From 1ccd88747edc05e035255d53eefadd46492bdf23 Mon Sep 17 00:00:00 2001 From: Reksotiv Date: Thu, 23 Mar 2023 20:18:30 +0300 Subject: [PATCH] Fixed restoring app position for multiscreen (#7353) --- qt/MainWindow.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/qt/MainWindow.cpp b/qt/MainWindow.cpp index 5976ff4128b..e6763e6edc7 100644 --- a/qt/MainWindow.cpp +++ b/qt/MainWindow.cpp @@ -101,24 +101,7 @@ void SC_MainWindow::loadHistory() tr( "We have reset your configuration settings due to major changes to the GUI" ) ); } - // Restoring the ui to a previously stored place that is potentially not the primary monitor causes issues for some users. See https://github.com/simulationcraft/simc/issues/5047 - // Until we can figure out why this is happening and can be resolved, restoring the ui position is intentionally disabled - if constexpr(false) - { - QVariant size = settings.value( "gui/size" ); - QRect savedApplicationGeometry = geometry(); - if ( size.isValid() ) - { - savedApplicationGeometry.setSize( size.toSize() ); - } - QVariant pos = settings.value( "gui/position" ); - if ( pos.isValid() ) - { - savedApplicationGeometry.moveTopLeft( pos.toPoint() ); - } - setGeometry(savedApplicationGeometry); - } - + restoreGeometry( settings.value( "gui/geometry" ).toByteArray() ); QVariant maximized = settings.value( "gui/maximized" ); if ( maximized.isValid() ) { @@ -181,8 +164,7 @@ void SC_MainWindow::saveHistory() QSettings settings; settings.beginGroup( "gui" ); settings.setValue( "gui_version_number", SC_GUI_HISTORY_VERSION ); - settings.setValue( "size", normalGeometry().size() ); - settings.setValue( "position", normalGeometry().topLeft() ); + settings.setValue( "geometry", saveGeometry() ); settings.setValue( "maximized", bool( windowState() & Qt::WindowMaximized ) ); settings.endGroup();