I believe this fixes the bug of items coming back wrong

This commit is contained in:
Chris Cochrun 2023-01-13 05:49:56 -06:00
parent ae27bfdbab
commit 278afe7989

View file

@ -338,14 +338,14 @@ bool ServiceItemModel::moveRows(int sourceIndex, int destIndex, int count) {
const bool isMoveDown = destIndex > sourceIndex; const bool isMoveDown = destIndex > sourceIndex;
if (!beginMoveRows(parent, sourceIndex, sourceIndex + count - 1, if (!beginMoveRows(parent, sourceIndex, sourceIndex + count - 1,
parent, isMoveDown ? destIndex + 1 : destIndex)) { parent, isMoveDown ? destIndex + 2 : destIndex)) {
qDebug() << "Can't move rows"; qDebug() << "Can't move rows";
return false; return false;
} }
qDebug() << "starting move: " << "source: " << sourceIndex << "dest: " << destIndex; qDebug() << "starting move: " << "source: " << sourceIndex << "dest: " << destIndex;
m_items.insert(destIndex, m_items.takeAt(isMoveDown ? sourceIndex : sourceIndex + 1)); m_items.move(sourceIndex, isMoveDown ? destIndex + 1 : destIndex);
endMoveRows(); endMoveRows();
return true; return true;