From 60eb306efe786f645ceb15a4e60cdbb90afff1d2 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 29 Sep 2020 23:27:24 +0200 Subject: QAbstractItemView: Don't allow CopyAction for InternalMove views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Morten Johan Sørvig --- src/widgets/itemviews/qabstractitemview.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets/itemviews') 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) -- cgit v1.2.3