From b0544be068a86dff3f6ac040d2edb10b5e4339a4 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Fri, 14 Oct 2022 21:32:05 +0800 Subject: [PATCH] Added activeTab property --- src/AutoHideDockContainer.cpp | 2 + src/DockWidgetSideTab.cpp | 12 ++++++ src/DockWidgetSideTab.h | 5 +++ src/stylesheets/default.css | 57 ++++++++++++++++++++++++++ src/stylesheets/focus_highlighting.css | 12 +++--- 5 files changed, 82 insertions(+), 6 deletions(-) diff --git a/src/AutoHideDockContainer.cpp b/src/AutoHideDockContainer.cpp index 0d6f700..626b438 100644 --- a/src/AutoHideDockContainer.cpp +++ b/src/AutoHideDockContainer.cpp @@ -459,6 +459,8 @@ void CAutoHideDockContainer::collapseView(bool Enable) d->DockManager->setDockWidgetFocused(d->DockWidget); qApp->installEventFilter(this); } + + d->DockWidget->sideTabWidget()->updateStyle(); } diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index 1ee9a7d..b62ca81 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -322,6 +322,18 @@ void CDockWidgetSideTab::updateOrientationAndSpacing(SideTabBarArea area) } +//============================================================================ +bool CDockWidgetSideTab::isActiveTab() const +{ + if (d->DockWidget->autoHideDockContainer()) + { + return d->DockWidget->autoHideDockContainer()->isVisible(); + } + + return false; +} + + //============================================================================ CDockWidget* CDockWidgetSideTab::dockWidget() const { diff --git a/src/DockWidgetSideTab.h b/src/DockWidgetSideTab.h index 3a6e716..bb8dc9f 100644 --- a/src/DockWidgetSideTab.h +++ b/src/DockWidgetSideTab.h @@ -52,6 +52,7 @@ class ADS_EXPORT CDockWidgetSideTab : public QFrame Q_PROPERTY(SideTabBarArea sideTabBarArea READ sideTabBarArea) Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + Q_PROPERTY(bool activeTab READ isActiveTab) private: DockWidgetSideTabPrivate* d; ///< private data (pimpl) @@ -139,6 +140,10 @@ public: */ void updateOrientationAndSpacing(SideTabBarArea area); + /** + * Returns true, if this is the active tab. The tab is active if the auto hide widget is visible + */ + bool isActiveTab() const; /** * returns the dock widget this belongs to diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index 42cf1c1..127baed 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -41,6 +41,63 @@ ads--CDockWidgetTab[activeTab="true"] QLabel { ads--CDockWidgetSideTab { background: palette(window); + qproperty-iconSize: 16px 16px;/* this is optional in case you would like to change icon size*/ +} + +ads--CDockWidgetSideTab[sideTabBarArea="0"] { + border-top: 3px solid grey; + border-right: 1px solid white; +} + +ads--CDockWidgetSideTab[sideTabBarArea="1"],[sideTabBarArea="2"] { + border-left: 3px solid grey; + border-bottom: 1px solid white; +} + +ads--CDockWidgetSideTab[sideTabBarArea="3"],[sideTabBarArea="4"] { + border-right: 3px solid grey; + border-bottom: 1px solid white; +} + +ads--CDockWidgetSideTab[sideTabBarArea="5"] { + 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"],:hover[sideTabBarArea="2"] { + border-left: 3px solid palette(highlight); +} + +ads--CDockWidgetSideTab:hover[sideTabBarArea="3"],:hover[sideTabBarArea="4"] { + border-right: 3px solid palette(highlight); +} + +ads--CDockWidgetSideTab:hover[sideTabBarArea="5"] { + 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"] { + border-left: 3px solid palette(highlight); +} + +ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"],[sideTabBarArea="4"][focused="true"] { + border-right: 3px solid palette(highlight); +} + +ads--CDockWidgetSideTab[sideTabBarArea="5"][activeTab="true"] { + border-bottom: 3px solid palette(highlight); } ads--CDockWidget { diff --git a/src/stylesheets/focus_highlighting.css b/src/stylesheets/focus_highlighting.css index 1a6fe77..a24aa9a 100644 --- a/src/stylesheets/focus_highlighting.css +++ b/src/stylesheets/focus_highlighting.css @@ -141,27 +141,27 @@ ads--CDockWidgetSideTab:hover[sideTabBarArea="5"] { border-bottom: 3px solid palette(highlight); } -ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][focused="true"] { +ads--CDockWidgetSideTab:hover[sideTabBarArea="0"][activeTab="true"] { border-top: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="0"][focused="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="0"][activeTab="true"] { border-top: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="1"][focused="true"],[sideTabBarArea="2"][focused="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="1"][activeTab="true"],[sideTabBarArea="2"][activeTab="true"] { border-left: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="3"][focused="true"],[sideTabBarArea="4"][focused="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="3"][activeTab="true"],[sideTabBarArea="4"][focused="true"] { border-right: 3px solid palette(highlight); } -ads--CDockWidgetSideTab[sideTabBarArea="5"][focused="true"] { +ads--CDockWidgetSideTab[sideTabBarArea="5"][activeTab="true"] { border-bottom: 3px solid palette(highlight); } -ads--CDockWidgetTab[focused="true"] { +ads--CDockWidgetTab[activeTab="true"] { background: palette(highlight); border-color: palette(highlight); }