src/main.cpp

changeset 240
414d392b9ae6
parent 237
10a6298f636f
child 241
c4e2afabcb90
--- 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();

mercurial