diff options
author | David Faure <[email protected]> | 2024-09-19 16:09:21 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2024-09-23 11:40:11 +0000 |
commit | f70e4a49c9ca35c1c0ee62f188505868ff7027b3 (patch) | |
tree | f85bc2a7bbb72f79a63e5aa87b47fe5705402323 | |
parent | e8122a0a9c6090c8ebe26d5d12320da3267a87c0 (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.cpp | 4 |
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(); + } } } } |