diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 9be17387618..3d615f84f5e 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -883,8 +883,9 @@ void QListView::dropEvent(QDropEvent *event) { Q_D(QListView); - if (event->source() == this && (event->dropAction() == Qt::MoveAction || - dragDropMode() == QAbstractItemView::InternalMove)) { + const bool moveAction = event->dropAction() == Qt::MoveAction + || dragDropMode() == QAbstractItemView::InternalMove; + if (event->source() == this && moveAction) { QModelIndex topIndex; bool topIndexDropped = false; int col = -1; @@ -937,7 +938,7 @@ void QListView::dropEvent(QDropEvent *event) if (!d->commonListView->filterDropEvent(event) || !d->dropEventMoved) { // icon view didn't move the data, and moveRows not implemented, so fall back to default - if (!d->dropEventMoved) + if (!d->dropEventMoved && moveAction) event->ignore(); QAbstractItemView::dropEvent(event); }