From 760c0365e0ed8fd289abb2a435f55b5dcca83238 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 1 Nov 2022 11:35:07 +0100 Subject: [PATCH] Use explicit naming for functions to configure auto hide flags and disable auto hide feature by default --- demo/MainWindow.cpp | 4 ++-- examples/autohide/mainwindow.cpp | 2 +- src/DockManager.cpp | 6 +++--- src/DockManager.h | 12 +++++++++--- src/SideTabBar.cpp | 1 - 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index ba5db06..f0bf1fe 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -654,7 +654,7 @@ CMainWindow::CMainWindow(QWidget *parent) : CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); // uncomment if you would like to enable dock widget auto hiding - CDockManager::setConfigFlags(CDockManager::DefaultAutoHideConfig); + CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig); // uncomment if you would like to enable an equal distribution of the // available size of a splitter to all contained dock widgets @@ -749,7 +749,7 @@ void CMainWindow::onViewToggled(bool Open) return; } - //qDebug() << DockWidget->objectName() << " viewToggled(" << Open << ")"; + qDebug() << DockWidget->objectName() << " viewToggled(" << Open << ")"; } diff --git a/examples/autohide/mainwindow.cpp b/examples/autohide/mainwindow.cpp index 30061aa..4ae68be 100644 --- a/examples/autohide/mainwindow.cpp +++ b/examples/autohide/mainwindow.cpp @@ -27,7 +27,7 @@ CMainWindow::CMainWindow(QWidget *parent) CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true); CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false); CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); - CDockManager::setConfigFlag(CDockManager::DefaultAutoHideConfig, true); + CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig); DockManager = new CDockManager(this); // Set central widget diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 5899192..13cf731 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -93,7 +93,7 @@ enum eStateFileVersion }; static CDockManager::ConfigFlags StaticConfigFlags = CDockManager::DefaultNonOpaqueConfig; -static CDockManager::AutoHideFlags StaticAutoHideConfigFlags = CDockManager::DefaultAutoHideConfig; +static CDockManager::AutoHideFlags StaticAutoHideConfigFlags; // auto hide feature is disabled by default static QString FloatingContainersTitle; @@ -1159,7 +1159,7 @@ void CDockManager::setConfigFlags(const ConfigFlags Flags) //=========================================================================== -void CDockManager::setConfigFlags(const AutoHideFlags Flags) +void CDockManager::setAutoHideConfigFlags(const AutoHideFlags Flags) { StaticAutoHideConfigFlags = Flags; } @@ -1173,7 +1173,7 @@ void CDockManager::setConfigFlag(eConfigFlag Flag, bool On) //=========================================================================== -void CDockManager::setConfigFlag(eAutoHideFlag Flag, bool On) +void CDockManager::setAutoHideConfigFlag(eAutoHideFlag Flag, bool On) { internal::setFlag(StaticAutoHideConfigFlags, Flag, On); } diff --git a/src/DockManager.h b/src/DockManager.h index 74ba44a..9591945 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -226,9 +226,15 @@ public: }; Q_DECLARE_FLAGS(ConfigFlags, eConfigFlag) + + /** + * These global configuration flags configure some dock manager auto hide + * settings + * Set the dock manager flags, before you create the dock manager instance. + */ enum eAutoHideFlag { - AutoHideFeatureEnabled = 0x01, + AutoHideFeatureEnabled = 0x01, //!< enables / disables auto hide feature DockAreaHasAutoHideButton = 0x02, //!< If the flag is set each dock area has a auto hide menu button LeftSideBarIconOnly = 0x04, //!< If the flag is set left side bar will show only icon if a the dock widget has an icon assigned RightSideBarIconOnly = 0x08, //!< If the flag is set right side bar will show only icon if a the dock widget has an icon assigned @@ -279,7 +285,7 @@ public: * Call this function before you create the dock manager and before * your create the first dock widget. */ - static void setConfigFlags(const AutoHideFlags Flags); + static void setAutoHideConfigFlags(const AutoHideFlags Flags); /** * Set a certain config flag. @@ -291,7 +297,7 @@ public: * Set a certain overlay config flag. * \see setConfigFlags() */ - static void setConfigFlag(eAutoHideFlag Flag, bool On = true); + static void setAutoHideConfigFlag(eAutoHideFlag Flag, bool On = true); /** * Returns true if the given config flag is set diff --git a/src/SideTabBar.cpp b/src/SideTabBar.cpp index 7bd03c1..beb2d61 100644 --- a/src/SideTabBar.cpp +++ b/src/SideTabBar.cpp @@ -117,7 +117,6 @@ CSideTabBar::CSideTabBar(CDockContainerWidget* parent, SideBarLocation area) : CSideTabBar::~CSideTabBar() { qDebug() << "~CSideTabBar() "; - qDebug() << "parent " << d->ContainerWidget; // The SideTabeBar is not the owner of the tabs and to prevent deletion // we set the parent here to nullptr to remove it from the children auto Tabs = findChildren(QString(), Qt::FindDirectChildrenOnly);