diff --git a/src/plugins/coreplugin/welcomepagehelper.cpp b/src/plugins/coreplugin/welcomepagehelper.cpp index 3fc432f7d01..1486ba95ea1 100644 --- a/src/plugins/coreplugin/welcomepagehelper.cpp +++ b/src/plugins/coreplugin/welcomepagehelper.cpp @@ -118,6 +118,10 @@ static const TextFormat &buttonTF(Button::Role role, WidgetState state) static const TextFormat smallLinkHoveredTF {Theme::Token_Text_Accent, smallLinkDefaultTF.uiElement, smallLinkDefaultTF.drawTextFlags}; + static const TextFormat tagDefaultTF + {Theme::Token_Text_Muted, StyleHelper::UiElement::UiElementLabelMedium}; + static const TextFormat tagHoverTF + {Theme::Token_Text_Default, tagDefaultTF.uiElement}; switch (role) { case Button::MediumPrimary: return mediumPrimaryTF; @@ -128,6 +132,8 @@ static const TextFormat &buttonTF(Button::Role role, WidgetState state) : smallListCheckedTF; case Button::SmallLink: return (state == WidgetStateDefault) ? smallLinkDefaultTF : smallLinkHoveredTF; + case Button::Tag: return (state == WidgetStateDefault) ? tagDefaultTF + : tagHoverTF; } return mediumPrimaryTF; } @@ -218,6 +224,13 @@ void Button::paintEvent(QPaintEvent *event) } case SmallLink: break; + case Tag: { + const QBrush fill(hovered ? creatorColor(Theme::Token_Foreground_Subtle) + : QBrush(Qt::NoBrush)); + const QPen outline(hovered ? QPen(Qt::NoPen) : creatorColor(Theme::Token_Stroke_Subtle)); + drawCardBackground(&p, bgR, fill, outline, brRectRounding); + break; + } } if (!m_pixmap.isNull()) { @@ -244,6 +257,10 @@ void Button::setPixmap(const QPixmap &pixmap) void Button::updateMargins() { + if (m_role == Tag) { + setContentsMargins(HPaddingXs, VPaddingXxs, HPaddingXs, VPaddingXxs); + return; + } const bool tokenSizeS = m_role == MediumPrimary || m_role == MediumSecondary || m_role == SmallList || m_role == SmallLink; const int gap = tokenSizeS ? HGapS : HGapXs; diff --git a/src/plugins/coreplugin/welcomepagehelper.h b/src/plugins/coreplugin/welcomepagehelper.h index eb3082129a1..e1c9199cfe4 100644 --- a/src/plugins/coreplugin/welcomepagehelper.h +++ b/src/plugins/coreplugin/welcomepagehelper.h @@ -80,6 +80,7 @@ public: SmallSecondary, SmallList, SmallLink, + Tag, }; explicit Button(const QString &text, Role role, QWidget *parent = nullptr);