summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Faure <[email protected]>2024-09-19 16:09:21 +0200
committerQt Cherry-pick Bot <[email protected]>2024-09-23 11:40:11 +0000
commitf70e4a49c9ca35c1c0ee62f188505868ff7027b3 (patch)
treef85bc2a7bbb72f79a63e5aa87b47fe5705402323
parente8122a0a9c6090c8ebe26d5d12320da3267a87c0 (diff)
QTableView: fix moving rows by drag-n-drop
If we don't set dropEventMoved to true, then QAbstractItemView::startDrag will delete the rows after the move (after QDrag::exec() returns). Fixes: QTBUG-129128 Change-Id: I85e7903a12b13c4b73e34fa1fcac56e50f421191 Reviewed-by: Volker Hilsheimer <[email protected]> (cherry picked from commit d2384783477e88190fb87287bb9af8ea9a46343e) Reviewed-by: Qt Cherry-pick Bot <[email protected]> (cherry picked from commit 7f35844ed0beb48ed6ebdab9d56cd832c188cb90)
-rw-r--r--src/widgets/itemviews/qtableview.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index f0ac4a78fe0..7c407db4646 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -3165,8 +3165,10 @@ void QTableView::dropEvent(QDropEvent *event)
}
r = pIndex.row() + 1; // Dropped items are inserted contiguously and in the right order.
}
- if (dataMoved)
+ if (dataMoved) {
+ d->dropEventMoved = true;
event->accept();
+ }
}
}
}