Merge remote-tracking branch 'origin/pr/4234'

This commit is contained in:
Florian Bruhin 2018-09-22 21:14:54 +02:00
commit e9ca4c4295

View File

@ -620,11 +620,15 @@ class TabBar(QTabBar):
qtutils.ensure_valid(size)
return size
def paintEvent(self, _e):
def paintEvent(self, event):
"""Override paintEvent to draw the tabs like we want to."""
p = QStylePainter(self)
selected = self.currentIndex()
for idx in range(self.count()):
if not event.region().intersects(self.tabRect(idx)):
# Don't repaint if we are outside the requested region
continue
tab = QStyleOptionTab()
self.initStyleOption(tab, idx)
@ -640,10 +644,6 @@ class TabBar(QTabBar):
indicator_color = self.tab_indicator_color(idx)
tab.palette.setColor(QPalette.Base, indicator_color)
if tab.rect.right() < 0 or tab.rect.left() > self.width():
# Don't bother drawing a tab if the entire tab is outside of
# the visible tab bar.
continue
p.drawControl(QStyle.CE_TabBarTab, tab)
def tabInserted(self, idx):