From 0cbc810a5afe0c7c08e8d321d2282f26c66d9553 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Tue, 18 Oct 2022 15:29:31 +0200 Subject: [PATCH] Renamed SideTabIconLabel - added C prefix CSideTabIconLabel --- src/DockWidgetSideTab.cpp | 21 +++++++++++---------- src/DockWidgetSideTab.h | 7 ++++--- src/stylesheets/default.css | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/DockWidgetSideTab.cpp b/src/DockWidgetSideTab.cpp index eafe96b..d3a7a1d 100644 --- a/src/DockWidgetSideTab.cpp +++ b/src/DockWidgetSideTab.cpp @@ -57,7 +57,7 @@ struct DockWidgetSideTabPrivate CSideTabBar* SideTabBar; QSize IconSize; Qt::Orientation Orientation{Qt::Vertical}; - SideTabIconLabel* IconLabel = nullptr; + CSideTabIconLabel* IconLabel = nullptr; QIcon Icon; /** @@ -129,7 +129,7 @@ void DockWidgetSideTabPrivate::createLayout() TitleLabel = new tTabLabel(); TitleLabel->setElideMode(Qt::ElideRight); TitleLabel->setText(DockWidget->windowTitle()); - TitleLabel->setObjectName("dockWidgetTabLabel"); + TitleLabel->setObjectName("sideTabLabel"); _this->connect(TitleLabel, SIGNAL(elidedChanged(bool)), SIGNAL(elidedChanged(bool))); // Fill the layout @@ -231,7 +231,7 @@ void CDockWidgetSideTab::setIcon(const QIcon& Icon) if (!d->IconLabel) { - d->IconLabel = new SideTabIconLabel(); + d->IconLabel = new CSideTabIconLabel(); internal::setToolTip(d->IconLabel, d->TitleLabel->toolTip()); Layout->insertWidget(0, d->IconLabel, Qt::AlignHCenter); } @@ -345,27 +345,28 @@ CDockWidget* CDockWidgetSideTab::dockWidget() const */ struct SideTabIconLabelPrivate { - SideTabIconLabel* _this; + CSideTabIconLabel* _this; QLabel* IconLabel; QBoxLayout* Layout; - SideTabIconLabelPrivate(SideTabIconLabel* _public); + SideTabIconLabelPrivate(CSideTabIconLabel* _public); }; // struct SideTabIconLabelPrivate //============================================================================ -SideTabIconLabelPrivate::SideTabIconLabelPrivate(SideTabIconLabel* _public) : +SideTabIconLabelPrivate::SideTabIconLabelPrivate(CSideTabIconLabel* _public) : _this(_public) { } //============================================================================ -SideTabIconLabel::SideTabIconLabel(QWidget* parent) : QWidget(parent), +CSideTabIconLabel::CSideTabIconLabel(QWidget* parent) : QFrame(parent), d(new SideTabIconLabelPrivate(this)) { d->Layout = new QBoxLayout(QBoxLayout::TopToBottom); d->Layout->addWidget(d->IconLabel = new QLabel()); + d->IconLabel->setObjectName("sideTabIconLabel"); d->Layout->setAlignment(Qt::AlignCenter); d->IconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); setLayout(d->Layout); @@ -373,21 +374,21 @@ SideTabIconLabel::SideTabIconLabel(QWidget* parent) : QWidget(parent), //============================================================================ -SideTabIconLabel::~SideTabIconLabel() +CSideTabIconLabel::~CSideTabIconLabel() { delete d; } //============================================================================ -void SideTabIconLabel::setPixmap(const QPixmap& pixmap) +void CSideTabIconLabel::setPixmap(const QPixmap& pixmap) { d->IconLabel->setPixmap(pixmap); } //============================================================================ -void SideTabIconLabel::setContentsMargins(int left, int top, int right, int bottom) +void CSideTabIconLabel::setContentsMargins(int left, int top, int right, int bottom) { d->Layout->setContentsMargins(left, top, right, bottom); } diff --git a/src/DockWidgetSideTab.h b/src/DockWidgetSideTab.h index 76560e2..7e50dd8 100644 --- a/src/DockWidgetSideTab.h +++ b/src/DockWidgetSideTab.h @@ -152,14 +152,15 @@ Q_SIGNALS: void clicked(); }; // class DockWidgetSideTab -class SideTabIconLabel : public QWidget +class CSideTabIconLabel : public QFrame { + Q_OBJECT private: SideTabIconLabelPrivate *d; ///< private data (pimpl) public: - SideTabIconLabel(QWidget* parent = nullptr); - virtual ~SideTabIconLabel(); + CSideTabIconLabel(QWidget* parent = nullptr); + virtual ~CSideTabIconLabel(); void setPixmap(const QPixmap &pixmap); void setContentsMargins(int left, int top, int right, int bottom); diff --git a/src/stylesheets/default.css b/src/stylesheets/default.css index 10eac4a..342967b 100644 --- a/src/stylesheets/default.css +++ b/src/stylesheets/default.css @@ -116,10 +116,24 @@ ads--CDockWidgetSideTab { ads--CDockWidgetSideTab[sideTabBarArea="0"] { border-right: 1px solid white; + background: red; +} + +#sideTabLabel { + background: green; +} + +#sideTabIconLabel { + background: blue; +} + +ads--CSideTabIconLabel { + border: 1px solid yellow } ads--CDockWidgetSideTab[sideTabBarArea="1"] { border-bottom: 1px solid white; + background: red; } ads--CDockWidgetSideTab[sideTabBarArea="2"] {