Browse Source

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 <[email protected]>
Chris Galvan 4 years ago
parent
commit
edbe05bd81

+ 4 - 0
Code/Framework/AzQtComponents/AzQtComponents/Components/WindowDecorationWrapper.cpp

@@ -661,6 +661,10 @@ namespace AzQtComponents
         if (!restoreGeometryFromSettings())
         if (!restoreGeometryFromSettings())
         {
         {
             show();
             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);
         }
         }
     }
     }
 
 

+ 2 - 1
Code/Tools/ProjectManager/Source/Application.cpp

@@ -170,7 +170,8 @@ namespace O3DE::ProjectManager
         // the decoration wrapper is intended to remember window positioning and sizing 
         // the decoration wrapper is intended to remember window positioning and sizing 
         auto wrapper = new AzQtComponents::WindowDecorationWrapper();
         auto wrapper = new AzQtComponents::WindowDecorationWrapper();
         wrapper->setGuest(m_mainWindow.data());
         wrapper->setGuest(m_mainWindow.data());
-        wrapper->show();
+        wrapper->enableSaveRestoreGeometry("O3DE", "ProjectManager", "mainWindowGeometry");
+        wrapper->showFromSettings();
         m_mainWindow->show();
         m_mainWindow->show();
 
 
         qApp->setQuitOnLastWindowClosed(true);
         qApp->setQuitOnLastWindowClosed(true);