From 9eb9ee407169fa50af5f820d935dfccadcb7fc65 Mon Sep 17 00:00:00 2001 From: Syarif Fakhri Date: Wed, 19 Oct 2022 17:35:36 +0800 Subject: [PATCH] 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; - }*/ + } }