diff --git a/demo/MainWindow.cpp b/demo/MainWindow.cpp index a522515..61f9874 100644 --- a/demo/MainWindow.cpp +++ b/demo/MainWindow.cpp @@ -734,7 +734,7 @@ CMainWindow::CMainWindow(QWidget *parent) : CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true); // uncomment if you would like to enable dock widget auto hiding - CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig); + CDockManager::setAutoHideConfigFlags({CDockManager::DefaultAutoHideConfig | CDockManager::AutoHideCloseButtonCollapsesDock}); // uncomment if you would like to enable an equal distribution of the // available size of a splitter to all contained dock widgets diff --git a/doc/cfg_flag_AutoHideCloseButtonCollapsesDock_false.gif b/doc/cfg_flag_AutoHideCloseButtonCollapsesDock_false.gif new file mode 100644 index 0000000..24c7c99 Binary files /dev/null and b/doc/cfg_flag_AutoHideCloseButtonCollapsesDock_false.gif differ diff --git a/doc/cfg_flag_AutoHideCloseButtonCollapsesDock_true.gif b/doc/cfg_flag_AutoHideCloseButtonCollapsesDock_true.gif new file mode 100644 index 0000000..4b971c4 Binary files /dev/null and b/doc/cfg_flag_AutoHideCloseButtonCollapsesDock_true.gif differ diff --git a/doc/user-guide.md b/doc/user-guide.md index 7a3122e..176b321 100644 --- a/doc/user-guide.md +++ b/doc/user-guide.md @@ -39,6 +39,7 @@ - [`AutoHideButtonCheckable`](#autohidebuttoncheckable) - [`AutoHideSideBarsIconOnly`](#autohidesidebarsicononly) - [`AutoHideShowOnMouseOver`](#autohideshowonmouseover) + - [`AutoHideCloseButtonCollapsesDock`](#autohideclosebuttoncollapsesdock) - [DockWidget Feature Flags](#dockwidget-feature-flags) - [`DockWidgetClosable`](#dockwidgetclosable) - [`DockWidgetMovable`](#dockwidgetmovable) @@ -589,6 +590,21 @@ is shown, if the user hovers over the Auto-Hide tab or if the users moves the mouse outside of the Auto-Hide widget. Showing and hiding my mouse click still works if this feature is enabled. +### `AutoHideCloseButtonCollapsesDock` + +Some users don't understand the distinction between closing an auto hide dock and +collapsing an auto hide dock. This may lead to situations where they press the +close button (losing the side tab widget) instead of simply clicking outside +the auto hide dock (collapsing the dock). + +![AutoHideCloseButtonCollapsesDock false](cfg_flag_AutoHideCloseButtonCollapsesDock_false.gif) + +If `AutoHideCloseButtonCollapsesDock` option is active, the +close button in an auto hide widget collapses the auto hide widget instead of +closing it. + +![AutoHideCloseButtonCollapsesDock true](cfg_flag_AutoHideCloseButtonCollapsesDock_true.gif) + ## DockWidget Feature Flags ### `DockWidgetClosable` diff --git a/src/DockManager.h b/src/DockManager.h index f723f11..8085f1c 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -245,7 +245,7 @@ public: AutoHideButtonCheckable = 0x08, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes. AutoHideSideBarsIconOnly = 0x10,///< show only icons in auto hide side tab - if a tab has no icon, then the text will be shown AutoHideShowOnMouseOver = 0x20, ///< show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container - AutoHideCloseButtonCollapsesDock = 0x40, ///< Close button of an auto hide container closes the dock instead of hiding it completely + AutoHideCloseButtonCollapsesDock = 0x40, ///< Close button of an auto hide container collapses the dock instead of hiding it completely DefaultAutoHideConfig = AutoHideFeatureEnabled | DockAreaHasAutoHideButton ///< the default configuration for left and right side bars