Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.12.5, 5.12.6
-
None
Description
Implemented QML Dynamic View Ordering by Dragging View Items using this Qt tutorial: QML Dynamic View Ordering Tutorial. Only changed original underlying model which is QAbstractListModel descendant in our case. Model stores data in a QList<QObject*> objectList; field type.
Was necessary to change items order automatically in original underlying model as well (not only in DelegateModel) for other C++ and QML consumers where this order matters. Implemented this by adding void ObjectListModel::move(int from, int to) to the ObjectListModel implementation like I've mentioned here on Stackoverflow:
void ObjectListModel::move(int from, int to) { if(0 <= from && from < count() && 0 <= to && to < count() && from != to) { if(from == to - 1) // Allow item moving to the bottom to = from++; beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); objectList.move(from, to); endMoveRows(); } }
However another model consumer like MapItemView fails to use the model after beginMoveRows/endMoveRows calls: moved indicator item disappeared on the map (not destroyed or visibility changed) and other manipulations with the item crashes the app.
Map { ... MapItemView { model: objectListModel delegate: SomeItemIndicator { } } }
Think Qt bug. Some other hacks like emitting dataChanged() signal, etc do not help as well.
Attachments
Issue Links
- relates to
-
QTBUG-74616 DelegateModel leaks m_cache entries when using transitions/incubators
- Reported