summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-29 23:27:24 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-01 21:10:05 +0200
commit60eb306efe786f645ceb15a4e60cdbb90afff1d2 (patch)
treec9e465ab5bade3c82bcd9c8a021fc7ba5498574a /src/widgets/itemviews
parentecfda98d1f91c6a7da0d89826558d856cd88e670 (diff)
QAbstractItemView: Don't allow CopyAction for InternalMove views
Otherwise the default action will be Copy, and the (+) cursor will show when moving items in e.g a QListView/Widget, even though the item will actually be moved. The documentation of InternalMove states clearly that "The view accepts move (not copy) operations only from itself.". Task-number: QTBUG-87057 Pick-to: 5.15 Change-Id: Idaa9e8f84623ced51b1c51a3730466dc0678d6b3 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 20488f8f85..198c26bd24 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -3693,6 +3693,8 @@ void QAbstractItemView::startDrag(Qt::DropActions supportedActions)
drag->setMimeData(data);
drag->setHotSpot(d->pressedPosition - rect.topLeft());
Qt::DropAction defaultDropAction = Qt::IgnoreAction;
+ if (dragDropMode() == InternalMove)
+ supportedActions &= ~Qt::CopyAction;
if (d->defaultDropAction != Qt::IgnoreAction && (supportedActions & d->defaultDropAction))
defaultDropAction = d->defaultDropAction;
else if (supportedActions & Qt::CopyAction && dragDropMode() != QAbstractItemView::InternalMove)