1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

VerticalTabs: Move scrollbar to the left

This commit is contained in:
David Rosca 2018-02-02 15:18:36 +01:00
parent 805c23ddb9
commit a1101c129c
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 4 additions and 8 deletions

View File

@ -78,7 +78,6 @@ void TabTreeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
const QWidget *w = option.widget; const QWidget *w = option.widget;
const QStyle *style = w ? w->style() : m_view->style(); const QStyle *style = w ? w->style() : m_view->style();
const bool reverse = m_view->isRightToLeft();
const bool expanded = m_view->isExpanded(index); const bool expanded = m_view->isExpanded(index);
const bool children = m_view->model()->rowCount(index) > 0; const bool children = m_view->model()->rowCount(index) > 0;
const int depth = indexDepth(index); const int depth = indexDepth(index);
@ -115,17 +114,11 @@ void TabTreeDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
// Draw expand button // Draw expand button
if (children) { if (children) {
QStyle::PrimitiveElement element;
if (expanded) {
element = QStyle::PE_IndicatorArrowDown;
} else {
element = reverse ? QStyle::PE_IndicatorArrowLeft : QStyle::PE_IndicatorArrowRight;
}
QStyleOptionViewItem o = opt; QStyleOptionViewItem o = opt;
o.state &= ~QStyle::State_MouseOver; o.state &= ~QStyle::State_MouseOver;
o.rect.moveLeft(m_indentation * depth); o.rect.moveLeft(m_indentation * depth);
o.rect.setWidth(m_indentation); o.rect.setWidth(m_indentation);
style->drawPrimitive(element, &o, painter, w); style->drawPrimitive(expanded ? QStyle::PE_IndicatorArrowDown : QStyle::PE_IndicatorArrowRight, &o, painter, w);
} }
// Draw icon // Draw icon

View File

@ -43,6 +43,9 @@ TabTreeView::TabTreeView(QWidget *parent)
m_delegate = new TabTreeDelegate(this); m_delegate = new TabTreeDelegate(this);
setItemDelegate(m_delegate); setItemDelegate(m_delegate);
// Move scrollbar to the left
setLayoutDirection(isRightToLeft() ? Qt::LeftToRight : Qt::RightToLeft);
} }
bool TabTreeView::areTabsInOrder() const bool TabTreeView::areTabsInOrder() const