Mon, 20 Jun 2022 21:49:39 +0300
some improvements to dock widget handling
src/main.cpp | file | annotate | diff | comparison | revisions | |
src/mainwindow.ui | file | annotate | diff | comparison | revisions | |
src/settings.h | file | annotate | diff | comparison | revisions |
--- a/src/main.cpp Mon Jun 20 21:14:27 2022 +0300 +++ b/src/main.cpp Mon Jun 20 21:49:39 2022 +0300 @@ -364,6 +364,7 @@ uiutilities::makeKeySequenceMap(uiutilities::collectActions(&mainWindow)); const auto saveSettings = [&]{ setSetting<Setting::MainWindowGeometry>(mainWindow.saveGeometry()); + setSetting<Setting::MainWindowState>(mainWindow.saveState()); setSetting<Setting::RecentFiles>(recentlyOpenedFiles); setSetting<Setting::RenderStyle>(renderPreferences.style); setSetting<Setting::DrawAxes>(renderPreferences.drawAxes); @@ -644,7 +645,14 @@ } }); mainWindow.setWindowTitle(title()); + mainWindow.tabifyDockWidget(ui.messageLogDock, ui.toolOptionsDock); mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>()); + mainWindow.restoreState(setting<Setting::MainWindowState>()); + // If a dock is made floating and the app is closed, the dock becomes invisible + // after the restoreState call. So we make them visible again shere. + for (QDockWidget* dock : mainWindow.findChildren<QDockWidget*>()) { + dock->setVisible(true); + } restoreSettings(); updateRenderPreferences(&ui, &renderPreferences, &documents); mainWindow.show();
--- a/src/mainwindow.ui Mon Jun 20 21:14:27 2022 +0300 +++ b/src/mainwindow.ui Mon Jun 20 21:49:39 2022 +0300 @@ -14,10 +14,7 @@ <string>LDForge</string> </property> <property name="dockNestingEnabled"> - <bool>true</bool> - </property> - <property name="dockOptions"> - <set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set> + <bool>false</bool> </property> <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -45,7 +42,7 @@ <x>0</x> <y>0</y> <width>729</width> - <height>31</height> + <height>40</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -162,7 +159,7 @@ <bool>false</bool> </attribute> </widget> - <widget class="QDockWidget" name="dockWidget_2"> + <widget class="QDockWidget" name="toolOptionsDock"> <property name="features"> <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set> </property> @@ -214,7 +211,7 @@ </layout> </widget> </widget> - <widget class="QDockWidget" name="dockWidget"> + <widget class="QDockWidget" name="messageLogDock"> <property name="features"> <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set> </property>
--- a/src/settings.h Mon Jun 20 21:14:27 2022 +0300 +++ b/src/settings.h Mon Jun 20 21:49:39 2022 +0300 @@ -35,6 +35,7 @@ SETTING(Wireframe, false) SETTING(DrawAxes, true) SETTING(MainWindowGeometry, QByteArray{}) +SETTING(MainWindowState, QByteArray{}) SETTING(MainSplitterState, QByteArray{}) SETTING(RecentFiles, QStringList{}) SETTING(ViewMode, QMdiArea::TabbedView)