summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qheaderview.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-12-23 22:16:26 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2021-01-17 13:57:50 +0100
commit09696e3325ec443b539d13e6e422c52951b01bdc (patch)
tree09dd6d38a1422ac1ecf431855d49afa9ed5b3bf7 /src/widgets/itemviews/qheaderview.cpp
parentcfd935fe6c26800befc10889afc0aebde311acca (diff)
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 <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/itemviews/qheaderview.cpp')
-rw-r--r--src/widgets/itemviews/qheaderview.cpp7
1 files changed, 4 insertions, 3 deletions
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);