When associating a C++ model to a ListView, delegates not currently displayed are not correctly rendered on model dataChanged signals.
To meet this issue, several conditions must be present:
- C++ model must fill its data after the ListView initialization
- C++ model must have more rows than displayed in the ListView (you must scroll the ListView)
- ListView must use a delegate with a Text meeting three conditions:
- When the model is not loaded, Text must be empty
- the Text must have a fixed width
- the Text must be clipped
When all these conditions are present, when the model load its data and launch for each of them a dataChanged signal, all Text of lines not displayed on ListView initial position are not rendered (even if currently displayed on model loading).
The Text component have a correct width, implicitWidth and contentWidth and calling forceLayout() or update() doesn't solve it. Changing most of properties doesn't change anything as well (rotation, antialiasing, etc.) except:
- clip: you can set the clip property to false, let QML do at least a frame rendering and then set again the clip property to true
- width: set a new width and immediately restore the previous one
The issue wasn't there on Qt5.14.2.
I've created a test program to reproduce the issue attached to the ticket, just launch it and click on "Load All Model" to simulate a delayed model.