diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2019-08-23 07:09:58 +0300 |
---|---|---|
committer | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2019-08-27 06:52:49 +0300 |
commit | 40a3f394508b59afc7ecab96eca8c1316b09890d (patch) | |
tree | e6896ba1ee8ab48c7967a8003ac4ed3262e9278e | |
parent | 7c45ae56c3399ea59b8a312e2f1194301020d241 (diff) |
Fix saving window geometry in restarts
Task-number: QT3DS-3892
Change-Id: I1808e3b1bec850016d7981a428187ad0eeccbc4f
Reviewed-by: Janne Kangas <janne.kangas@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/Authoring/Qt3DStudio/Application/StudioApp.cpp | 8 | ||||
-rw-r--r-- | src/Authoring/Qt3DStudio/MainFrm.cpp | 11 | ||||
-rw-r--r-- | src/Authoring/Qt3DStudio/MainFrm.h | 5 | ||||
-rw-r--r-- | src/Authoring/Qt3DStudio/UI/StudioAppPrefsPage.cpp | 2 |
4 files changed, 11 insertions, 15 deletions
diff --git a/src/Authoring/Qt3DStudio/Application/StudioApp.cpp b/src/Authoring/Qt3DStudio/Application/StudioApp.cpp index ada6c513..635a49ce 100644 --- a/src/Authoring/Qt3DStudio/Application/StudioApp.cpp +++ b/src/Authoring/Qt3DStudio/Application/StudioApp.cpp @@ -719,7 +719,13 @@ void CStudioApp::initCore() if (m_views) { m_views->createViews(m_isSilent); m_pMainWnd = m_views->getMainFrame(); - m_pMainWnd->initializeGeometryAndState(); + if (!CStudioPreferences::containsWindowState(STUDIO_VERSION_NUM)) { + // On first run, save and restore geometry and state. For some reason they are both + // needed to avoid a bug with palettes resizing to their original size when window is + // resized or something in a palette is edited. + m_pMainWnd->handleGeometryAndState(true); + } + m_pMainWnd->handleGeometryAndState(false); } RegisterGlobalKeyboardShortcuts(m_core->GetHotKeys(), m_pMainWnd); diff --git a/src/Authoring/Qt3DStudio/MainFrm.cpp b/src/Authoring/Qt3DStudio/MainFrm.cpp index 987a39e2..e59b7c1c 100644 --- a/src/Authoring/Qt3DStudio/MainFrm.cpp +++ b/src/Authoring/Qt3DStudio/MainFrm.cpp @@ -1969,17 +1969,6 @@ void CMainFrame::handleRestart() QProcess::startDetached(qApp->arguments()[0], presentationFile); } -void CMainFrame::initializeGeometryAndState() -{ - if (!CStudioPreferences::containsWindowState(STUDIO_VERSION_NUM)) { - // On first run, save and restore geometry and state. For some reason they are both needed - // to avoid a bug with palettes resizing to their original size when window is resized or - // something in a palette is edited. - handleGeometryAndState(true); - } - handleGeometryAndState(false); -} - void CMainFrame::toggleSelectMode() { if (m_ui->actionItem_Select_Tool->isChecked()) diff --git a/src/Authoring/Qt3DStudio/MainFrm.h b/src/Authoring/Qt3DStudio/MainFrm.h index be78dc19..52c23be4 100644 --- a/src/Authoring/Qt3DStudio/MainFrm.h +++ b/src/Authoring/Qt3DStudio/MainFrm.h @@ -235,8 +235,6 @@ public: QWidget *GetActiveView() const; CPlayerWnd *GetPlayerWnd() const; - void initializeGeometryAndState(); - void toggleSelectMode(); void showScene(); QString getVariantsFilterStr() const; @@ -244,12 +242,13 @@ public: void updateToolbarVariantsIcons(bool isFiltered); void setActionsEnabledStatus(bool enabled); + void handleGeometryAndState(bool save); + Q_SIGNALS: void playStateChanged(bool started); protected: bool eventFilter(QObject *obj, QEvent *event) override; - void handleGeometryAndState(bool save); void handleRestart(); QScopedPointer<QT_PREPEND_NAMESPACE(Ui::MainFrame)> m_ui; diff --git a/src/Authoring/Qt3DStudio/UI/StudioAppPrefsPage.cpp b/src/Authoring/Qt3DStudio/UI/StudioAppPrefsPage.cpp index 4d4f9457..df918d19 100644 --- a/src/Authoring/Qt3DStudio/UI/StudioAppPrefsPage.cpp +++ b/src/Authoring/Qt3DStudio/UI/StudioAppPrefsPage.cpp @@ -41,6 +41,7 @@ #include "ClientDataModelBridge.h" #include "Core.h" #include "IStudioRenderer.h" +#include "MainFrm.h" #include <QtWidgets/qmessagebox.h> #include <QtWidgets/qlistview.h> @@ -410,6 +411,7 @@ void CStudioAppPrefsPage::checkRestartCondition() "Restart now?")); if (retval == QMessageBox::Yes) { + g_StudioApp.GetViews()->getMainFrame()->handleGeometryAndState(true); CStudioPreferences::savePreferences(); CStudioPreferencesPropPage::endDialog(PREFS_SETTINGS_RESTART); } |