Hi everyone,
I am coding an application that needs to show items using a QTableView, so I subclassed QAbstractItemModel to allow handling of the data without duplication. (My data is stored into a QList using pointers)
I store this pointer into a custom role in each row element (the user can only move rows, not separate items).
When moving items using drag & drop I obtain this assert fail :
ASSERT failure in QPersistentModelIndex::~QPersistentModelIndex: "persistent model indexes corrupted", file kernel\qabstractitemmodel.cpp, line 544
To copy to clipboard, switch view to plain text mode
There are few usage examples of the beginMoveRows and endMoveRows methods because it's quite new (4.6), but I think I used it correctly, so the problem must be somewhere else...
This is the code where I use this methods :
continue;
mScript->moveAction(rowId, position);
endMoveRows();
if(!beginMoveRows(QModelIndex(), rowId, rowId, QModelIndex(), position))
continue;
mScript->moveAction(rowId, position);
endMoveRows();
To copy to clipboard, switch view to plain text mode
mScript is my QList with pointers, and I use the move method.
Please say I you need more extracts...
Bookmarks