aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Portale <[email protected]>2025-07-01 16:52:09 +0200
committerAlessandro Portale <[email protected]>2025-07-01 15:37:12 +0000
commit8c80e67b75acd85fe088eac07466aeee298094a2 (patch)
treef25cde5372d325f52ad6bf8a844c36c174e2ca74
parent4d9d215070c1a5e669c570503a3748de9b28b451 (diff)
Utils: Polish QtcTabBarHEADmaster
- Keep a small gap between active/hover highlights - Draw a continuous thin line on the bottom Change-Id: I373a074fea3784b2cda33c03bee2293fcbfc621a Reviewed-by: Cristian Adam <[email protected]>
-rw-r--r--src/libs/utils/qtcwidgets.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libs/utils/qtcwidgets.cpp b/src/libs/utils/qtcwidgets.cpp
index 0c388c5a364..705f565bd49 100644
--- a/src/libs/utils/qtcwidgets.cpp
+++ b/src/libs/utils/qtcwidgets.cpp
@@ -843,6 +843,11 @@ QtcTabBar::QtcTabBar(QWidget *parent)
void QtcTabBar::paintEvent([[maybe_unused]] QPaintEvent *event)
{
QPainter p(this);
+ const int padding = PaddingHXxs;
+ const QRectF borderR = rect().toRectF().adjusted(padding + 0.5, 0.5, -(padding + 0.5), -0.5);
+ p.setPen(creatorColor(isEnabled() ? Theme::Token_Stroke_Subtle
+ : Theme::Token_Foreground_Subtle));
+ p.drawLine(borderR.bottomLeft(), borderR.bottomRight());
p.setFont(TabBarTf.font());
for (int tabIndex = 0; tabIndex < count(); tabIndex++) {
QStyleOptionTab opt;
@@ -851,7 +856,7 @@ void QtcTabBar::paintEvent([[maybe_unused]] QPaintEvent *event)
const bool enabled = isEnabled();
const bool hovered = !selected && opt.rect.contains(mapFromGlobal(QCursor::pos()));
if (selected || (hovered && enabled)) {
- QRect highLightRect = opt.rect;
+ QRect highLightRect = opt.rect.adjusted(padding, 0, -padding, 0);
highLightRect.moveTop(highLightRect.height() - StyleHelper::HighlightThickness);
const QColor color = creatorColor(enabled ? hovered ? Theme::Token_Text_Subtle
: Theme::Token_Accent_Default