A customer detected that if model inherited from QAbstractListModel gets update at the time QML ListView is reading the data, the result ends up corrupted. Namely the items in view get misplaced.
(See attached screenshot - ListViewOverlap.png - it shows item with index 7 being drawn on top of item at index 0.)
Sample codes that reveal the issue are attached. (ListViewBug_cpp.tar.gz and ListViewBug_qml.zip)
The sample code in ListViewBug_cpp.tar.gz does a call from ListView delegate to the ListView model. It is completely understood that this kind of implementation is error prone and should not be used, it is done , as the situation seems to depend on timing and is a tricky thing to get to occur 100%.
The new attachment ListViewBug_qml.zip has an implementation that produces the overlapping items without communication from the delegate to the model. It also uses QML model without any custom implementation.
However the ListViewBug_qml version is not fully reliable to cause issues. E.g. it does not cause overlap on my PC if I run it on Linux, whereas the issue is 100% reproduceable if I run it on Windows. Both are native installations, not virtual boxed.
That being said, it is obvious that the issue in ListViewBug_cpp gets solved by removing the call to the list model from delegate but that is not the point here as the problem can occur also without a call to list model (like in ListViewBug_qml).
Instructions for ListViewBug_qml:
Start the app.
Wait 1 second for the timer to expire.
Instructions for ListViewBug_cpp:
Start the app.
List already should be mixed, e.g. indexes are not 0, 1 and 2.
If no visual errors (missing items or overlap) is visible, press "Shuffle" button.
Repeat previous step if necessary.