QListView: don't ignore an event accepted by a subclass
If a subclass reimplements dropEvent() to accept a CopyAction, then don't ignore the event again in the QListView implementation. We only have to ignore a MoveAction event if the handling so far didn't actually move the data, so that the QAIV implementation can handle the removal of the source data if needed. Complex interaction between QListView and QAbstractItemView, especially in IconView mode, and sadly not generally unit-testable, like all drag'n'drop interactions (due to modally blocking QDrag::exec on most platforms). Pick-to: 6.8 Fixes: QTBUG-103898 Change-Id: I032c27e2788ec7e652a830383d8400b06b57d8cb Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
parent
481b6c72b4
commit
690184cf25
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user