From fde80071746149b54f83e15513d73a5441c75fb8 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Tue, 18 Oct 2022 10:22:56 +0800 Subject: [PATCH 1/8] reduce margin a little bit for the horizontal component --- src/DockWidgetSideTab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index eafe96b..2f483f8 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -106,7 +106,7 @@ struct DockWidgetSideTabPrivate } else if (Orientation == Qt::Horizontal) { - TitleLayout->setContentsMargins(Spacing / 2, Spacing, Spacing, Spacing); + TitleLayout->setContentsMargins(Spacing / 2, Spacing, Spacing, Spacing / 2); if (IconLabel) { IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, 0, Spacing / 2); From 1c6968525703a138440c694d74acbe313e52d29c Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Tue, 18 Oct 2022 10:33:03 +0800 Subject: [PATCH 2/8] Update css --- src/stylesheets/default.css | 24 ++++++++--------- src/stylesheets/default_linux.css | 28 +++++++++----------- src/stylesheets/focus_highlighting.css | 28 +++++++++----------- src/stylesheets/focus_highlighting_linux.css | 28 +++++++++----------- 4 files changed, 51 insertions(+), 57 deletions(-) diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index 10eac4a..93c7971 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -115,55 +115,55 @@ ads--CDockWidgetSideTab { } ads--CDockWidgetSideTab[sideTabBarArea="0"] { + border-top: 3px solid grey; border-right: 1px solid white; } ads--CDockWidgetSideTab[sideTabBarArea="1"] { + border-left: 3px solid grey; border-bottom: 1px solid white; } ads--CDockWidgetSideTab[sideTabBarArea="2"] { + border-right: 3px solid grey; border-bottom: 1px solid white; } ads--CDockWidgetSideTab[sideTabBarArea="3"] { + border-bottom: 3px solid grey; border-right: 1px solid white; } ads--CDockWidgetSideTab:hover[sideTabBarArea="0"] { - + border-top: 3px solid palette(highlight); } ads--CDockWidgetSideTab:hover[sideTabBarArea="1"] { - + border-left: 3px solid palette(highlight); } ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { - + border-right: 3px solid palette(highlight); } ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { - -} - -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] { - + border-bottom: 3px solid palette(highlight); } ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] { - + border-top: 3px solid palette(highlight); } ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"] { - + border-left: 3px solid palette(highlight); } ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { - + border-right: 3px solid palette(highlight); } ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { - + border-bottom: 3px solid palette(highlight); } /* diff --git a/src/stylesheets/default_linux.css b/src/stylesheets/default_linux.css index e92531e..19dfd4c 100644 --- a/src/stylesheets/default_linux.css +++ b/src/stylesheets/default_linux.css @@ -43,7 +43,10 @@ ads--CDockWidgetTab[activeTab="true"] QLabel { color: palette(foreground); } -/* Side tab styling */ +/*----------------------------------------------------------------------------- + * Styling of auto hide functionality + *---------------------------------------------------------------------------- + */ ads--CDockWidgetSideTab { background: palette(window); qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ @@ -54,17 +57,17 @@ ads--CDockWidgetSideTab[sideTabBarArea="0"] { border-right: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="1"],[sideTabBarArea="2"] { +ads--CDockWidgetSideTab[sideTabBarArea="1"] { border-left: 3px solid grey; border-bottom: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="3"],[sideTabBarArea="4"] { +ads--CDockWidgetSideTab[sideTabBarArea="2"] { border-right: 3px solid grey; border-bottom: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="5"] { +ads--CDockWidgetSideTab[sideTabBarArea="3"] { border-bottom: 3px solid grey; border-right: 1px solid white; } @@ -73,38 +76,33 @@ ads--CDockWidgetSideTab:hover[sideTabBarArea="0"] { border-top: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="1"],:hover[sideTabBarArea="2"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="1"] { border-left: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="3"],:hover[sideTabBarArea="4"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { border-right: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="5"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { border-bottom: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] { - border-top: 3px solid palette(highlight); -} - ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] { border-top: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"],[sideTabBarArea="2"][activeTab="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"] { border-left: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"],[sideTabBarArea="4"][focused="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { border-right: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="5"][activeTab="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { border-bottom: 3px solid palette(highlight); } -/* Side tab styling */ ads--CDockWidget { background: palette(light); diff --git a/src/stylesheets/focus_highlighting.css b/src/stylesheets/focus_highlighting.css index 84df17e..cb15762 100644 --- a/src/stylesheets/focus_highlighting.css +++ b/src/stylesheets/focus_highlighting.css @@ -36,7 +36,10 @@ ads--CDockWidgetTab[activeTab="true"] QLabel { color: palette(foreground); } -/* Side tab styling */ +/*----------------------------------------------------------------------------- + * Styling of auto hide functionality + *---------------------------------------------------------------------------- + */ ads--CDockWidgetSideTab { background: palette(window); qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ @@ -47,17 +50,17 @@ ads--CDockWidgetSideTab[sideTabBarArea="0"] { border-right: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="1"],[sideTabBarArea="2"] { +ads--CDockWidgetSideTab[sideTabBarArea="1"] { border-left: 3px solid grey; border-bottom: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="3"],[sideTabBarArea="4"] { +ads--CDockWidgetSideTab[sideTabBarArea="2"] { border-right: 3px solid grey; border-bottom: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="5"] { +ads--CDockWidgetSideTab[sideTabBarArea="3"] { border-bottom: 3px solid grey; border-right: 1px solid white; } @@ -66,38 +69,33 @@ ads--CDockWidgetSideTab:hover[sideTabBarArea="0"] { border-top: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="1"],:hover[sideTabBarArea="2"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="1"] { border-left: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="3"],:hover[sideTabBarArea="4"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { border-right: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="5"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { border-bottom: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] { - border-top: 3px solid palette(highlight); -} - ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] { border-top: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"],[sideTabBarArea="2"][activeTab="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"] { border-left: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"],[sideTabBarArea="4"][focused="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { border-right: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="5"][activeTab="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { border-bottom: 3px solid palette(highlight); } -/* Side tab styling */ ads--CDockWidget { background: palette(light); diff --git a/src/stylesheets/focus_highlighting_linux.css b/src/stylesheets/focus_highlighting_linux.css index 140d6d7..5c9e2d9 100644 --- a/src/stylesheets/focus_highlighting_linux.css +++ b/src/stylesheets/focus_highlighting_linux.css @@ -44,7 +44,10 @@ ads--CDockWidgetTab[activeTab="true"] QLabel { color: palette(foreground); } -/* Side tab styling */ +/*----------------------------------------------------------------------------- + * Styling of auto hide functionality + *---------------------------------------------------------------------------- + */ ads--CDockWidgetSideTab { background: palette(window); qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ @@ -55,17 +58,17 @@ ads--CDockWidgetSideTab[sideTabBarArea="0"] { border-right: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="1"],[sideTabBarArea="2"] { +ads--CDockWidgetSideTab[sideTabBarArea="1"] { border-left: 3px solid grey; border-bottom: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="3"],[sideTabBarArea="4"] { +ads--CDockWidgetSideTab[sideTabBarArea="2"] { border-right: 3px solid grey; border-bottom: 1px solid white; } -ads--CDockWidgetSideTab[sideTabBarArea="5"] { +ads--CDockWidgetSideTab[sideTabBarArea="3"] { border-bottom: 3px solid grey; border-right: 1px solid white; } @@ -74,38 +77,33 @@ ads--CDockWidgetSideTab:hover[sideTabBarArea="0"] { border-top: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="1"],:hover[sideTabBarArea="2"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="1"] { border-left: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="3"],:hover[sideTabBarArea="4"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="2"] { border-right: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="5"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="3"] { border-bottom: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] { - border-top: 3px solid palette(highlight); -} - ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] { border-top: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"],[sideTabBarArea="2"][activeTab="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"] { border-left: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"],[sideTabBarArea="4"][focused="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="2"][activeTab="true"] { border-right: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="5"][activeTab="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"] { border-bottom: 3px solid palette(highlight); } -/* Side tab styling */ ads--CDockWidget { background: palette(light); From 118e79e7ecb75f85d50459a8518332b60f8b41dc Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Tue, 18 Oct 2022 10:33:35 +0800 Subject: [PATCH 3/8] Remove config flag --- src/AutoHideDockContainer.cpp | 28 --------------------- src/AutoHideDockContainer.h | 5 ---- src/DockAreaTitleBar.cpp | 3 +-- src/DockContainerWidget.cpp | 47 +++++++---------------------------- src/DockManager.h | 24 ++++++------------ 5 files changed, 18 insertions(+), 89 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 3206380..b47bfe3 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -453,34 +453,6 @@ void CAutoHideDockContainer::toggleCollapseState() collapseView(isVisible()); } - -//============================================================================ -bool CAutoHideDockContainer::areaExistsInConfig(CDockWidgetSideTab::SideTabBarArea area) -{ - switch (area) - { - case CDockWidgetSideTab::Left: - { - return CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar); - } - case CDockWidgetSideTab::Right: - { - return CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar); - } - case CDockWidgetSideTab::Bottom: - { - return CDockManager::testConfigFlag(CDockManager::DockContainerHasBottomSideBar); - } - case CDockWidgetSideTab::Top: - { - return CDockManager::testConfigFlag(CDockManager::DockContainerHasTopSideBar); - } - } - - return true; -} - - //============================================================================ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event) { diff --git a/src/AutoHideDockContainer.h b/src/AutoHideDockContainer.h index 6ba264e..7aa90f5 100644 --- a/src/AutoHideDockContainer.h +++ b/src/AutoHideDockContainer.h @@ -152,11 +152,6 @@ public: * Toggles the current collapse state */ void toggleCollapseState(); - - /* - * Convenience function fr determining if area exists in config - */ - static bool areaExistsInConfig(CDockWidgetSideTab::SideTabBarArea area); }; } diff --git a/src/DockAreaTitleBar.cpp b/src/DockAreaTitleBar.cpp index ff0ce6e..9dd3641 100644 --- a/src/DockAreaTitleBar.cpp +++ b/src/DockAreaTitleBar.cpp @@ -191,8 +191,7 @@ void DockAreaTitleBarPrivate::createButtons() _this->connect(UndockButton, SIGNAL(clicked()), SLOT(onUndockButtonClicked())); // AutoHide Button - const auto autoHideEnabled = testConfigFlag(CDockManager::DockContainerHasRightSideBar) || testConfigFlag(CDockManager::DockContainerHasLeftSideBar) || testConfigFlag(CDockManager::DockContainerHasBottomSideBar); - AutoHideButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasAutoHideButton) && autoHideEnabled); + AutoHideButton = new CTitleBarButton(testConfigFlag(CDockManager::DockAreaHasAutoHideButton)); AutoHideButton->setObjectName("dockAreaAutoHideButton"); AutoHideButton->setAutoRaise(true); internal::setToolTip(AutoHideButton, QObject::tr("Toggle Auto Hide")); diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 70e481d..0fe88c9 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -1048,11 +1048,6 @@ bool DockContainerWidgetPrivate::restoreAutoHideDockArea(CDockingStateReader& s, ADS_PRINT("Restore NodeDockArea Tabs: " << Tabs << " Current: " << CurrentDockWidget); - if (!CAutoHideDockContainer::areaExistsInConfig(area)) - { - return false; - } - CDockAreaWidget* DockArea = nullptr; CAutoHideDockContainer* dockContainer = nullptr; if (!Testing) @@ -1503,12 +1498,6 @@ CAutoHideDockContainer* CDockContainerWidget::createAndInitializeAutoHideDockWid { DockWidget->setDockManager(d->DockManager); // Overlay Dock Container needs a valid dock manager } - if (!CAutoHideDockContainer::areaExistsInConfig(area)) - { - Q_ASSERT_X(false, "CDockContainerWidget::createAndInitializeDockWidgetOverlayContainer", - "Requested area does not exist in config"); - return nullptr; - } DockWidget->sideTabWidget()->updateOrientationAndSpacing(area); sideTabBar(area)->insertSideTab(insertOrder == CDockWidget::First ? 0 : -1, DockWidget->sideTabWidget()); @@ -2094,35 +2083,17 @@ void CDockContainerWidget::createRootSplitter() //============================================================================ void CDockContainerWidget::createSideTabBarWidgets() { - if (CDockManager::testConfigFlag(CDockManager::DockContainerHasLeftSideBar)) - { - auto leftLayout = new QVBoxLayout(); - d->SideTabBarWidgets[CDockWidgetSideTab::Left] = new CSideTabBar(this, Qt::Vertical); - leftLayout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Left]); - leftLayout->addStretch(1); - d->Layout->addLayout(leftLayout, 1, 0); - } + d->SideTabBarWidgets[CDockWidgetSideTab::Left] = new CSideTabBar(this, Qt::Vertical); + d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Left], 1, 0); + + d->SideTabBarWidgets[CDockWidgetSideTab::Right] = new CSideTabBar(this, Qt::Vertical); + d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Right],1,2); - if (CDockManager::testConfigFlag(CDockManager::DockContainerHasRightSideBar)) - { - auto rightLayout = new QVBoxLayout(); - d->SideTabBarWidgets[CDockWidgetSideTab::Right] = new CSideTabBar(this, Qt::Vertical); - rightLayout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Right]); - rightLayout->addStretch(1); - d->Layout->addLayout(rightLayout, 1, 2); - } + d->SideTabBarWidgets[CDockWidgetSideTab::Bottom] = new CSideTabBar(this, Qt::Horizontal); + d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Bottom], 2, 1); - if (CDockManager::testConfigFlag(CDockManager::DockContainerHasBottomSideBar)) - { - d->SideTabBarWidgets[CDockWidgetSideTab::Bottom] = new CSideTabBar(this, Qt::Horizontal); - d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Bottom], 2, 1); - } - - if (CDockManager::testConfigFlag(CDockManager::DockContainerHasTopSideBar)) - { - d->SideTabBarWidgets[CDockWidgetSideTab::Top] = new CSideTabBar(this, Qt::Horizontal); - d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Top], 0, 1); - } + d->SideTabBarWidgets[CDockWidgetSideTab::Top] = new CSideTabBar(this, Qt::Horizontal); + d->Layout->addWidget(d->SideTabBarWidgets[CDockWidgetSideTab::Top], 0, 1); } diff --git a/src/DockManager.h b/src/DockManager.h index a378486..83f1e45 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -226,23 +226,15 @@ public: enum eAutoHideFlag { - DockContainerHasLeftSideBar = 0x01, //!< If the flag is set the dock manager will have a left side bar - DockContainerHasRightSideBar = 0x02, //!< If the flag is set the dock manager will have a right side bar - DockContainerHasBottomSideBar = 0x04, //!< If the flag is set the dock manager will have a bottom side bar - DockContainerHasTopSideBar = 0x08, //!< If the flag is set the dock manager will have a top side bar - DockAreaHasAutoHideButton = 0x10, //!< If the flag is set each dock area has a auto hide menu button - LeftSideBarPrioritizeIconOnly = 0x20, //!< If the flag is set left side bar will prioritize showing icons only over text - RightSideBarPrioritizeIconOnly = 0x40, //!< If the flag is set right side bar will prioritize showing icons only over text - BottomSideBarPrioritizeIconOnly = 0x80,//!< If the flag is set bottom side bar will prioritize showing icons only over text - TopSideBarPrioritizeIconOnly = 0x100, //!< If the flag is set top side bar will prioritize showing icons only over text - AutoHideDockAreaHasTitle = 0x200, //!< If the flag is set overlay dock area title bar will show the window title - AutoHideButtonTogglesArea = 0x400, //!< 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 + DockAreaHasAutoHideButton = 0x01, //!< If the flag is set each dock area has a auto hide menu button + LeftSideBarPrioritizeIconOnly = 0x02, //!< If the flag is set left side bar will prioritize showing icons only over text + RightSideBarPrioritizeIconOnly = 0x04, //!< If the flag is set right side bar will prioritize showing icons only over text + BottomSideBarPrioritizeIconOnly = 0x08,//!< If the flag is set bottom side bar will prioritize showing icons only over text + 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 - DefaultAutoHideConfig = DockContainerHasLeftSideBar - | DockContainerHasRightSideBar - | DockContainerHasBottomSideBar - | DockContainerHasTopSideBar - | DockAreaHasAutoHideButton + DefaultAutoHideConfig = DockAreaHasAutoHideButton | AutoHideDockAreaHasTitle, ///< the default configuration for left and right side bars }; Q_DECLARE_FLAGS(AutoHideFlags, eAutoHideFlag) From d83ec7c66fe4d34cb35e1f0fe1f386a2c7088bb4 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Tue, 18 Oct 2022 17:21:10 +0800 Subject: [PATCH 4/8] 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 From 7319c52d4d46fdd13fc1ef4c1b9e324e4f545c56 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Wed, 19 Oct 2022 17:13:34 +0800 Subject: [PATCH 5/8] FIxed CMakeLists --- src/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f74775e..355f523 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,6 +30,7 @@ set(ads_SRCS SideTabBar.cpp DockWidgetSideTab.cpp AutoHideDockContainer.cpp + PushButton.cpp ads.qrc ) set(ads_HEADERS @@ -54,6 +55,7 @@ set(ads_HEADERS SideTabBar.h DockWidgetSideTab.h AutoHideDockContainer.h + PushButton.h ) add_compile_options("$<$:/utf-8>") if (UNIX AND NOT APPLE) From 7ed3f8b2d1cc804bcd80349ffb2f446704b0bd30 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Wed, 19 Oct 2022 17:30:08 +0800 Subject: [PATCH 6/8] Remove all dock widget focusable constraint on auto hide button --- src/DockAreaWidget.cpp | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index f23138f..e59f57e 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -315,11 +315,6 @@ struct DockAreaWidgetPrivate */ void updateTitleBarButtonVisibility(bool isTopLevel); - /** - * Convenience function to know if all dock widgets are focusable - */ - bool allDockWidgetsFocusable() const; - /** * Scans all contained dock widgets for the max. minimum size hint */ @@ -387,7 +382,7 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel) if (IsTopLevel) { TitleBar->button(TitleBarButtonClose)->setVisible(!container->isFloating()); - TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating() && allDockWidgetsFocusable()); + TitleBar->button(TitleBarButtonAutoHide)->setVisible(!container->isFloating()); // Undock and tabs should never show when auto hidden TitleBar->button(TitleBarButtonUndock)->setVisible(!container->isFloating() && !_this->isAutoHide()); TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide()); @@ -395,25 +390,12 @@ void DockAreaWidgetPrivate::updateTitleBarButtonVisibility(bool IsTopLevel) else { TitleBar->button(TitleBarButtonClose)->setVisible(true); - TitleBar->button(TitleBarButtonAutoHide)->setVisible(allDockWidgetsFocusable()); + TitleBar->button(TitleBarButtonAutoHide)->setVisible(true); TitleBar->button(TitleBarButtonUndock)->setVisible(!_this->isAutoHide()); TitleBar->button(TitleBarButtonTabsMenu)->setVisible(!_this->isAutoHide()); } } -bool DockAreaWidgetPrivate::allDockWidgetsFocusable() const -{ - for (const auto &dockWidget : _this->dockWidgets()) - { - if (!dockWidget->features().testFlag(CDockWidget::DockWidgetFocusable)) - { - return false; - } - } - - return true; -} - //============================================================================ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget* parent) : From 9eb9ee407169fa50af5f820d935dfccadcb7fc65 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Wed, 19 Oct 2022 17:35:36 +0800 Subject: [PATCH 7/8] fix icon only config for side tab bars --- src/DockWidgetSideTab.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index 673a3b3..0485057 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -141,34 +141,35 @@ void CDockWidgetSideTab::updateOrientationAndSpacing(SideTabBarArea area) { setOrientation((area == Bottom || area == Top) ? Qt::Horizontal : Qt::Vertical); - /*if (CDockManager::testConfigFlag(CDockManager::LeftSideBarPrioritizeIconOnly) && area == Left) + if (icon().isNull()) { - d->TitleLabel->hide(); - d->TitleLayout->setContentsMargins(0, 0, 0, 0); - d->IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, Spacing / 2, Spacing / 2); + return; + } + + if (CDockManager::testConfigFlag(CDockManager::LeftSideBarPrioritizeIconOnly) && area == Left) + { + setText(""); + setOrientation(Qt::Horizontal); return; } if (CDockManager::testConfigFlag(CDockManager::RightSideBarPrioritizeIconOnly) && area == Right) { - d->TitleLabel->hide(); - d->TitleLayout->setContentsMargins(0, 0, 0, 0); - d->IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, Spacing, Spacing / 2); + setText(""); + setOrientation(Qt::Horizontal); return; } if (CDockManager::testConfigFlag(CDockManager::BottomSideBarPrioritizeIconOnly) && area == Bottom) { - d->TitleLabel->hide(); - d->TitleLayout->setContentsMargins(0, 0, 0, 0); - d->IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, Spacing / 2, Spacing); + setText(""); + setOrientation(Qt::Horizontal); return; } if (CDockManager::testConfigFlag(CDockManager::TopSideBarPrioritizeIconOnly) && area == Top) { - d->TitleLabel->hide(); - d->TitleLayout->setContentsMargins(0, 0, 0, 0); - d->IconLabel->setContentsMargins(Spacing / 2, Spacing / 2, Spacing / 2, Spacing / 2); + setText(""); + setOrientation(Qt::Horizontal); return; - }*/ + } } From 10a75b041315ce4f2616731e771b89bb1088969e Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Wed, 19 Oct 2022 17:44:55 +0800 Subject: [PATCH 8/8] remove unused and cleanup --- src/DockWidgetSideTab.cpp | 4 ---- src/DockWidgetSideTab.h | 1 - 2 files changed, 5 deletions(-) diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index 0485057..c25f367 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -35,15 +35,11 @@ #include "DockAreaWidget.h" #include "DockManager.h" -#include "ElidingLabel.h" #include "DockWidget.h" namespace ads { - -using tTabLabel = CVerticalElidingLabel; - /** * Private data class of CDockWidgetTab class (pimpl) */ diff --git a/src/DockWidgetSideTab.h b/src/DockWidgetSideTab.h index 9246876..f307f37 100644 --- a/src/DockWidgetSideTab.h +++ b/src/DockWidgetSideTab.h @@ -85,7 +85,6 @@ public: /** * Default Constructor * param[in] DockWidget The dock widget this title bar belongs to - * param[in] Orientation Horizontal or vertical orientation * param[in] parent The parent widget of this title bar */ CDockWidgetSideTab(CDockWidget* DockWidget, QWidget* parent = nullptr);