summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qtabbar.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 1e8403c66b..1621356c40 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -1838,6 +1838,20 @@ void QTabBar::paintEvent(QPaintEvent *)
if (d->drawBase)
p.drawPrimitive(QStyle::PE_FrameTabBarBase, optTabBase);
+ // the buttons might be semi-transparent or not fill their rect, but we don't
+ // want the tab underneath to shine through, so clip the button area; QTBUG-50866
+ if (d->leftB->isVisible() || d->rightB->isVisible()) {
+ QStyleOption opt;
+ opt.initFrom(this);
+ QRegion buttonRegion;
+ if (d->leftB->isVisible())
+ buttonRegion |= style()->subElementRect(QStyle::SE_TabBarScrollLeftButton, &opt, this);
+ if (d->rightB->isVisible())
+ buttonRegion |= style()->subElementRect(QStyle::SE_TabBarScrollRightButton, &opt, this);
+ if (!buttonRegion.isEmpty())
+ p.setClipRegion(QRegion(rect()) - buttonRegion);
+ }
+
for (int i = 0; i < d->tabList.count(); ++i) {
const auto tab = d->tabList.at(i);
if (!tab->visible)