bool Model
::moveItem(const QModelIndex &fromParent,
int fromRow,
{
...
changePersistentIndex(pCurrent, index(toRow, 0, toParent));
if (up)
removeRows(fromRow + 1, 1, fromParent);
else
removeRows(fromRow, 1, fromParent);
...
}
bool Model::moveItem(const QModelIndex &fromParent, int fromRow,
const QModelIndex &toParent, int toRow, bool up)
{
...
QModelIndex to = index(toRow, 0, toParent);
QModelIndex from = index(fromRow, 0, fromParent);
QPersistentModelIndex pCurrent = from;
changePersistentIndex(pCurrent, index(toRow, 0, toParent));
if (up)
removeRows(fromRow + 1, 1, fromParent);
else
removeRows(fromRow, 1, fromParent);
...
}
To copy to clipboard, switch view to plain text mode
Bookmarks