summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2019-09-30 08:26:36 +0200
committerAndy Shaw <andy.shaw@qt.io>2019-10-02 14:14:08 +0200
commite02293a76d21e7077f1952d4ed8af6c6d1970190 (patch)
tree786564d0e2090e7e255ed1c1f2852154ec1d2fec /src/widgets/itemviews/qabstractitemview.cpp
parent2d8b80bb9c623c246c3815c3fd32cbd6392dc27b (diff)
Always update the pressed position when pressing on an item
If there is an item already selected then the pressed position needs to be updated regardless when selecting a new one even if it is not made current as this will be used to determine the drag distance. Otherwise it will start a drag within one pixel of moving due to the fact it is doing it relative to the first item to be pressed rather than the last. Fixes: QTBUG-78797 Change-Id: I853041b278b2e92ccf20660f7ced945fef72527a Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'src/widgets/itemviews/qabstractitemview.cpp')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index cb99214d4e..7d5e014dd5 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1775,8 +1775,8 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event)
QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate || !index.isValid();
QPoint offset = d->offset();
+ d->pressedPosition = pos + offset;
if ((command & QItemSelectionModel::Current) == 0) {
- d->pressedPosition = pos + offset;
d->currentSelectionStartIndex = index;
}
else if (!d->currentSelectionStartIndex.isValid())