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>
This commit is contained in:
parent
cfd935fe6c
commit
09696e3325
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user