Skip to content

Commit

Permalink
QTableView: fix moving rows by drag-n-drop
Browse files Browse the repository at this point in the history
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
Pick-to: 6.8 6.8.0
Change-Id: I85e7903a12b13c4b73e34fa1fcac56e50f421191
Reviewed-by: Volker Hilsheimer <[email protected]>
  • Loading branch information
dfaure-kdab committed Sep 19, 2024
1 parent 450f79e commit d238478
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/widgets/itemviews/qtableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3157,8 +3157,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();
}
}
}
}
Expand Down

0 comments on commit d238478

Please sign in to comment.