[Interest] Why are selections not preserved in QListView when resorting?
André Somers
andre at familiesomers.nl
Tue Nov 12 14:00:21 CET 2013
Philipp Kursawe schreef op 12-11-2013 13:46:
> There seems to be no concept of selection preservation in QListView
> (an probably other QAIViews).
> When I select the second element and then re-order the list, the
> selected item is still the second (index) but models data on index 2
> is not the same anymore.
>
> Am I doing something wrong?
No, I don´t think you´re doing anything wrong. QSFPM is.
The problem is that resorting isn´t using the beginMoveRows/endMoveRows
methods. The QItemSelectionModel has no way to know that the items in
the model have moved. It has no concept of there being an underlying
model that your _really_ looking at. By using the move signals, QSFPM
could in principal signal that items have not changed or the model
reset, but items merely have moved, and QISM could use that signal to
update itself, but again: it is unfortunately currently not implemented
that way.
André
More information about the Interest
mailing list