From d83ec7c66fe4d34cb35e1f0fe1f386a2c7088bb4 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Tue, 18 Oct 2022 17:21:10 +0800 Subject: [PATCH] Add config to make auto hide button optionally checkable for styling purposes --- src/DockAreaTitleBar.cpp | 2 ++ src/DockManager.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/DockAreaTitleBar.cpp b/src/DockAreaTitleBar.cpp index 9dd3641..a6e97ba 100644 --- a/src/DockAreaTitleBar.cpp +++ b/src/DockAreaTitleBar.cpp @@ -197,6 +197,8 @@ void DockAreaTitleBarPrivate::createButtons() internal::setToolTip(AutoHideButton, QObject::tr("Toggle Auto Hide")); internal::setButtonIcon(AutoHideButton, QStyle::SP_DialogOkButton, ads::AutoHideIcon); AutoHideButton->setSizePolicy(ButtonSizePolicy); + AutoHideButton->setCheckable(testConfigFlag(CDockManager::AutoHideButtonCheckable)); + AutoHideButton->setChecked(false); Layout->addWidget(AutoHideButton, 0); _this->connect(AutoHideButton, SIGNAL(clicked()), SLOT(onAutoHideButtonClicked())); diff --git a/src/DockManager.h b/src/DockManager.h index 83f1e45..3cc9e71 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -233,6 +233,7 @@ public: TopSideBarPrioritizeIconOnly = 0x10, //!< If the flag is set top side bar will prioritize showing icons only over text AutoHideDockAreaHasTitle = 0x20, //!< If the flag is set overlay dock area title bar will show the window title AutoHideButtonTogglesArea = 0x40, //!< If the flag is set, the auto hide button enables auto hiding for all dock widgets in an area, if disabled, only the current dock widget will be toggled + AutoHideButtonCheckable = 0x80, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes. DefaultAutoHideConfig = DockAreaHasAutoHideButton | AutoHideDockAreaHasTitle, ///< the default configuration for left and right side bars