1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

[ComboTabBar] Fixed draw issues with Oxygen theme

Always draw a selected tab in paint event. If the tab is not active,
let's just move the selected tab outside the tabbar's rect
This commit is contained in:
nowrep 2014-02-11 10:24:00 +01:00
parent c1293fca3f
commit ed13086e1d

View File

@ -979,13 +979,6 @@ void TabBarHelper::paintEvent(QPaintEvent* event)
continue; continue;
} }
// update mouse over state when scrolling
tab.state = tab.state & ~QStyle::State_MouseOver;
int index = tabAt(mapFromGlobal(QCursor::pos()));
if (i == index) {
tab.state = tab.state | QStyle::State_MouseOver;
}
p.drawControl(QStyle::CE_TabBarTab, tab); p.drawControl(QStyle::CE_TabBarTab, tab);
} }
@ -995,6 +988,14 @@ void TabBarHelper::paintEvent(QPaintEvent* event)
initStyleOption(&tab, selected); initStyleOption(&tab, selected);
if (!m_activeTabBar) { if (!m_activeTabBar) {
// If this is inactive tab, we still need to draw selected tab outside the tabbar
// Some themes (eg. Oxygen) draws line under tabs with selected tab
// Let's just move it outside rect(), it appears to work
QStyleOptionTabV3 tb = tab;
tb.rect.moveRight((rect().x() + rect().width()) * 2);
p.drawControl(QStyle::CE_TabBarTab, tb);
// Draw the tab without selected state
tab.state = tab.state & ~QStyle::State_Selected; tab.state = tab.state & ~QStyle::State_Selected;
} }