Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QAbstractItemModel::beginMoveRows 2 times or how to implement swapping in DataModel?
Kofr last edited by
Hello. I have DataModel which inherits QAbstractItemModel with Tree data structure.
I have a method
QAbstractItemModel::moveRowswhich swaps source and destination rows in case if they are one right after another (i.e. rows 5 and 6), but
QAbstractItemModel::beginMoveRowscan process only one source row at a time. So in case with swapping I move 2 rows simultaneously. So, how can I make swap (moves) right way?
p.s. Details of my implementation does not allow to detach one move from another.
BjornW last edited by
Maybe I am misunderstanding, but isn't "swapping" 5 and 6 the same as moving row 6 before 5? No need to move 5?