From 09696e3325ec443b539d13e6e422c52951b01bdc Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 23 Dec 2020 22:16:26 +0100 Subject: QHeaderView: fix moving sections with mouse in RTL mode Moving sections in RTL mode did not work correctly - in contrast to LTR mode the secion must be moved much further to the left or right to actually move it. Found while implementing an indicator for QTBUG-673 Task-number: QTBUG-673 Change-Id: I5a82d3cdb39415a408b2884d0ee302e0547e884f Reviewed-by: Volker Hilsheimer --- src/widgets/itemviews/qheaderview.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/widgets/itemviews/qheaderview.cpp') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 1ddcad8fd0..8ddbbd903a 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -2642,15 +2642,16 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e) if (visual == 0 && logicalIndex(0) == 0 && !d->allowUserMoveOfSection0) return; - int posThreshold = d->headerSectionPosition(visual) - d->offset + d->headerSectionSize(visual) / 2; + const int posThreshold = d->headerSectionPosition(visual) - d->offset + d->headerSectionSize(visual) / 2; + const int checkPos = d->reverse() ? d->viewport->width() - pos : pos; int moving = visualIndex(d->section); if (visual < moving) { - if (pos < posThreshold) + if (checkPos < posThreshold) d->target = d->logicalIndex(visual); else d->target = d->logicalIndex(visual + 1); } else if (visual > moving) { - if (pos > posThreshold) + if (checkPos > posThreshold) d->target = d->logicalIndex(visual); else d->target = d->logicalIndex(visual - 1); -- cgit v1.2.3