diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2018-03-14 07:45:08 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-03-14 10:15:08 +0000 |
commit | c56df4ada0db4fc0487cccc309fef3f3e2554e6e (patch) | |
tree | f640343e8e519911880f191bbd909b37967dfaf3 | |
parent | 645e7c7e9a64a40e227685adee9c48cf9b9ccffd (diff) |
Fix issues with palette resizing
Also fixes the issue with creeping palette sizes when using Studio in
maximized mode.
Task-number: QT3DS-968
Change-Id: I388d99a94a63baba88f61273a71c17e8a8aab3d6
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/Authoring/Studio/MainFrm.cpp | 17 | ||||
-rw-r--r-- | src/Authoring/Studio/MainFrm.h | 4 | ||||
-rw-r--r-- | src/Authoring/Studio/_Win/Application/StudioApp.cpp | 6 |
3 files changed, 20 insertions, 7 deletions
diff --git a/src/Authoring/Studio/MainFrm.cpp b/src/Authoring/Studio/MainFrm.cpp index 1998062e..9eb5da56 100644 --- a/src/Authoring/Studio/MainFrm.cpp +++ b/src/Authoring/Studio/MainFrm.cpp @@ -179,7 +179,6 @@ CMainFrame::CMainFrame() m_ui->actionPreviewRuntime2->setVisible(false); } - // Tool mode toolbar connect(m_ui->actionPosition_Tool, &QAction::triggered, this, &CMainFrame::OnToolMove); connect(m_ui->actionRotation_Tool, &QAction::triggered, this, &CMainFrame::OnToolRotate); @@ -292,7 +291,7 @@ void CMainFrame::hideEvent(QHideEvent *event) * Called when the main frame is actually created. Sets up tool bars and default * views. */ -int CMainFrame::OnCreate() +void CMainFrame::OnCreate() { m_SceneView = new CSceneView(&g_StudioApp, this); connect(m_SceneView, &CSceneView::toolChanged, this, &CMainFrame::OnUpdateToolChange); @@ -337,7 +336,6 @@ int CMainFrame::OnCreate() m_ui->actionImportAssets->setEnabled(false); setCentralWidget(m_SceneView); - return 0; } //============================================================================== @@ -1867,3 +1865,16 @@ void CMainFrame::handleGeometryAndState(bool save) restoreState(settings.value(stateKey).toByteArray(), STUDIO_VERSION_NUM); } } + +void CMainFrame::initializeGeometryAndState() +{ + QSettings settings; + QString stateKey = QStringLiteral("mainWindowState") + QString::number(STUDIO_VERSION_NUM); + if (!settings.contains(stateKey)) { + // 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); +} diff --git a/src/Authoring/Studio/MainFrm.h b/src/Authoring/Studio/MainFrm.h index fd398375..188551c0 100644 --- a/src/Authoring/Studio/MainFrm.h +++ b/src/Authoring/Studio/MainFrm.h @@ -97,7 +97,7 @@ public: CRecentItems *GetRecentItems(); - int OnCreate(); + void OnCreate(); void onPlaybackTimeout(); @@ -235,6 +235,8 @@ public: QWidget *GetActiveView(); CPlayerWnd *GetPlayerWnd() const; + void initializeGeometryAndState(); + Q_SIGNALS: void playStateChanged(bool started); diff --git a/src/Authoring/Studio/_Win/Application/StudioApp.cpp b/src/Authoring/Studio/_Win/Application/StudioApp.cpp index bd7a01e2..035918df 100644 --- a/src/Authoring/Studio/_Win/Application/StudioApp.cpp +++ b/src/Authoring/Studio/_Win/Application/StudioApp.cpp @@ -616,9 +616,8 @@ int CStudioApp::OpenAndRunApplication(const Q3DStudio::CString &inFilename) { int theSuccess = -1; InitCore(); - if (OnLoadDocument( - inFilename, - false)) // Load document. Upon failure, don't show startup dialog but exit immediately. + // Load document. Upon failure, don't show startup dialog but exit immediately. + if (OnLoadDocument(inFilename, false)) theSuccess = RunApplication(); return theSuccess; } @@ -630,6 +629,7 @@ int CStudioApp::OpenAndRunApplication(const Q3DStudio::CString &inFilename) */ int CStudioApp::RunApplication() { + m_pMainWnd->initializeGeometryAndState(); return qApp->exec(); } |