mirror of
https://invent.kde.org/network/falkon.git
synced 2024-09-22 02:02: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:
parent
c1293fca3f
commit
ed13086e1d
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user