From edbe05bd81eaff3b5bad649043af5cd6f692efed Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Thu, 22 Jul 2021 11:57:40 -0500 Subject: [PATCH] Fixed Project Manager to enable save/restore of the window geometry so its window position/sizing will be restored after it is closed/re-launched. Also improved WindowDecorationWrapper logic to center by default when using the showFromSettings API for first time launch. Signed-off-by: Chris Galvan --- .../AzQtComponents/Components/WindowDecorationWrapper.cpp | 4 ++++ Code/Tools/ProjectManager/Source/Application.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp b/Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp index 25aa575727..36f00f41f6 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp +++ b/Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp @@ -661,6 +661,10 @@ namespace AzQtComponents if (!restoreGeometryFromSettings()) { show(); + + // If we failed to restore from settings (the first time this window is loaded), + // then center it on the screen by default + centerOnScreen(this); } } diff --git a/Code/Tools/ProjectManager/Source/Application.cpp b/Code/Tools/ProjectManager/Source/Application.cpp index 8888febe3b..bdcb59897b 100644 --- a/Code/Tools/ProjectManager/Source/Application.cpp +++ b/Code/Tools/ProjectManager/Source/Application.cpp @@ -170,7 +170,8 @@ namespace O3DE::ProjectManager // the decoration wrapper is intended to remember window positioning and sizing auto wrapper = new AzQtComponents::WindowDecorationWrapper(); wrapper->setGuest(m_mainWindow.data()); - wrapper->show(); + wrapper->enableSaveRestoreGeometry("O3DE", "ProjectManager", "mainWindowGeometry"); + wrapper->showFromSettings(); m_mainWindow->show(); qApp->setQuitOnLastWindowClosed(true);