mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[ComboTabBar] Correctly set QStyleOptionTab::position for tabs
This fixes rendering of OnlyOneTab with Bespin theme.
This commit is contained in:
parent
90760eaa2b
commit
78fbccae15
@ -1207,6 +1207,25 @@ void TabBarHelper::mouseReleaseEvent(QMouseEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
void TabBarHelper::initStyleOption(QStyleOptionTab* option, int tabIndex) const
|
||||
{
|
||||
QTabBar::initStyleOption(option, tabIndex);
|
||||
|
||||
int index = m_pinnedTabBar ? tabIndex : m_comboTabBar->pinnedTabsCount() + tabIndex;
|
||||
|
||||
if (m_comboTabBar->count() > 1) {
|
||||
if (index == 0)
|
||||
option->position = QStyleOptionTab::Beginning;
|
||||
else if (index == m_comboTabBar->count() - 1)
|
||||
option->position = QStyleOptionTab::End;
|
||||
else
|
||||
option->position = QStyleOptionTab::Middle;
|
||||
}
|
||||
else {
|
||||
option->position = QStyleOptionTab::OnlyOneTab;
|
||||
}
|
||||
}
|
||||
|
||||
void TabBarHelper::resetDragState()
|
||||
{
|
||||
if (m_pressedIndex == -1) {
|
||||
|
@ -245,6 +245,8 @@ private:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
|
||||
void initStyleOption(QStyleOptionTab* option, int tabIndex) const;
|
||||
|
||||
ComboTabBar* m_comboTabBar;
|
||||
QScrollArea* m_scrollArea;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user