diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/itemviews/qheaderview.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 4e4c9572a3..9eb6c3465f 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2319,18 +2319,20 @@ void QHeaderView::paintEvent(QPaintEvent *e) d->prepareSectionSelected(); // clear and resize the bit array QRect currentSectionRect; - int logical; const int width = d->viewport->width(); const int height = d->viewport->height(); + const int rtlHorizontalOffset = d->reverse() ? 1 : 0; for (int i = start; i <= end; ++i) { if (d->isVisualIndexHidden(i)) continue; painter.save(); - logical = logicalIndex(i); + const int logical = logicalIndex(i); if (d->orientation == Qt::Horizontal) { - currentSectionRect.setRect(sectionViewportPosition(logical), 0, sectionSize(logical), height); + currentSectionRect.setRect(sectionViewportPosition(logical) + rtlHorizontalOffset, + 0, sectionSize(logical), height); } else { - currentSectionRect.setRect(0, sectionViewportPosition(logical), width, sectionSize(logical)); + currentSectionRect.setRect(0, sectionViewportPosition(logical), + width, sectionSize(logical)); } currentSectionRect.translate(offset); @@ -2776,9 +2778,9 @@ void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logical if (first && last) opt.position = QStyleOptionHeader::OnlyOneSection; else if (first) - opt.position = QStyleOptionHeader::Beginning; + opt.position = d->reverse() ? QStyleOptionHeader::End : QStyleOptionHeader::Beginning; else if (last) - opt.position = QStyleOptionHeader::End; + opt.position = d->reverse() ? QStyleOptionHeader::Beginning : QStyleOptionHeader::End; else opt.position = QStyleOptionHeader::Middle; opt.orientation = d->orientation; |