From b8dd91e35327792a60b0eeb06301086941926a5d Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 22 Sep 2021 21:45:42 +0800 Subject: [PATCH] MainWindow: make Outline dock fixed at the right side by default --- src/data/core/vnotex.json | 2 +- src/widgets/dockwidgethelper.cpp | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/data/core/vnotex.json b/src/data/core/vnotex.json index d853f7ce..beb7c755 100644 --- a/src/data/core/vnotex.json +++ b/src/data/core/vnotex.json @@ -378,7 +378,7 @@ "node_explorer_close_before_open_with_enabled" : true, "search_panel_advanced_settings_visible" : true, "//comment" : "Docks to ignore when expanding content area of main window", - "main_window_keep_docks_expanding_content_area": [], + "main_window_keep_docks_expanding_content_area": ["OutlineDock.vnotex"], "snippet_panel_builtin_snippets_visible" : true } } diff --git a/src/widgets/dockwidgethelper.cpp b/src/widgets/dockwidgethelper.cpp index c969fd28..6aca18f2 100644 --- a/src/widgets/dockwidgethelper.cpp +++ b/src/widgets/dockwidgethelper.cpp @@ -90,24 +90,29 @@ void DockWidgetHelper::setupDocks() m_dockIcons.resize(DockIndex::MaxDock); // The order of m_docks should be identical with enum DockIndex. + QVector tabifiedDockIndex; + + tabifiedDockIndex.append(m_docks.size()); setupNavigationDock(); setupOutlineDock(); + tabifiedDockIndex.append(m_docks.size()); setupHistoryDock(); + tabifiedDockIndex.append(m_docks.size()); setupSearchDock(); + tabifiedDockIndex.append(m_docks.size()); setupSnippetDock(); - for (int i = 1; i < m_docks.size(); ++i) { - m_mainWindow->tabifyDockWidget(m_docks[i - 1], m_docks[i]); - } - - // Following are non-tabfieid docks. setupLocationListDock(); setupShortcuts(); + + for (int i = 1; i < tabifiedDockIndex.size(); ++i) { + m_mainWindow->tabifyDockWidget(m_docks[tabifiedDockIndex[i - 1]], m_docks[tabifiedDockIndex[i]]); + } } void DockWidgetHelper::setupNavigationDock() @@ -131,7 +136,7 @@ void DockWidgetHelper::setupOutlineDock() dock->setWidget(m_mainWindow->m_outlineViewer); dock->setFocusProxy(m_mainWindow->m_outlineViewer); - m_mainWindow->addDockWidget(Qt::LeftDockWidgetArea, dock); + m_mainWindow->addDockWidget(Qt::RightDockWidgetArea, dock); } void DockWidgetHelper::setupSearchDock() @@ -406,6 +411,8 @@ void DockWidgetHelper::restoreDocks(const QStringList &p_visibleDocks) // At least make one visible. getDock(DockIndex::NavigationDock)->setVisible(true); } + + updateDockWidgetTabBar(); } bool DockWidgetHelper::isAnyDockVisible() const