Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.2, 5.11
-
2d9cf3ef0fc09254b1a63ab04b86d9beb52e71bc (qt/qtdeclarative/5.15)
Description
The following example demonstrates the issue. Click any list item to change the delegate. Note the difference in behavior between the two alternatives:
import QtQuick 2.0 import QtQml.Models 2.2 Item { width: 400 height: 400 property Component activeDelegate: yellowComponent Component { id: yellowComponent Rectangle { width: parent.width height: 50 color: "yellow" MouseArea { anchors.fill: parent onClicked: activeDelegate = redComponent } } } Component { id: redComponent Rectangle { width: parent.width height: 50 color: "red" MouseArea { anchors.fill: parent onClicked: activeDelegate = yellowComponent } } } ListView { id: listView anchors.fill: parent spacing: 1 // WORKS: this version updates as expected: when clicking a delegate, all delegates are updated //model: 10 //delegate: activeDelegate // DOESN'T: this version does not update as expected: when clicking a delegate, current delegates are not updated model: delegateModel } DelegateModel { id: delegateModel model: 10 // can also try with 100 for comparison (when scrolling, new delegates are correct, while cached ones are incorrect) delegate: activeDelegate } }