Commit 3f332a52 authored by Eike Hein's avatar Eike Hein
Browse files

Move correct indices in the manual sort map when getting a move() call for group children

Due to not passing `parent` to QAIM::index(), we were moving top-level
indices in the map instead. This meant the sort map would become out of
sync with the row move, and to the user it would look like both the
group children and unrelated top-level entries moved.

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent a8b71fe5
......@@ -1631,10 +1631,10 @@ bool TasksModel::move(int row, int newPos, const QModelIndex &parent)
beginMoveRows(parent, row, row, parent, (newPos > row) ? newPos + 1 : newPos);
// Translate to sort map indices.
const QModelIndex &groupingRowIndex = mapToSource(index(row, 0));
const QModelIndex &groupingRowIndex = mapToSource(index(row, 0, parent));
const QModelIndex &preFilterRowIndex = d->preFilterIndex(groupingRowIndex);
row = d->sortedPreFilterRows.indexOf(preFilterRowIndex.row());
newPos = d->sortedPreFilterRows.indexOf(d->preFilterIndex(mapToSource(index(newPos, 0))).row());
newPos = d->sortedPreFilterRows.indexOf(d->preFilterIndex(mapToSource(index(newPos, 0, parent))).row());
// Update sort mapping.
d->sortedPreFilterRows.move(row, newPos);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment