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>
This commit is contained in:
parent
ecfda98d1f
commit
60eb306efe
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user