1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[ComboTabBar] Correctly set QStyleOptionTab::position for tabs

This fixes rendering of OnlyOneTab with Bespin theme.
This commit is contained in:
David Rosca 2014-05-02 22:15:36 +02:00
parent 90760eaa2b
commit 78fbccae15
2 changed files with 21 additions and 0 deletions

View File

@ -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) {

View File

@ -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;