How to reset order of QAbstractListModel
Unsolved
QML and Qt Quick
-
@PhiBh
Depends what you mean by "a better way" :)I know nothing about QML, but this seems to be a straight Qt model/view question. You can use
begin
/endMove Rows()
. But I would do that if you are moving, say, 1 row around. It can get difficult to calculate if you are, say, sorting the entire list, or don't want to calculate which of many rows have been moved where. Then it is simpler to just call QAbstractItemModel::beginResetModel(), do your complete changes, andendResetModel()
. Note that you should then read the referenced documentation, telling you that all views and e.g.flags()
are reset. You would want to test this to see what effect it has on your existing views and how they refresh in response.