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 } }
Attachments
For Gerrit Dashboard: QTBUG-63477 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
208259,1 | Fix DelegateModel delegate changing | 5.9 | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
244576,3 | Fix DelegateModel delegate changing | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
261909,5 | When a DelegateModel delegate changes, refill the view | 5.14 | qt/qtdeclarative | Status: MERGED | +2 | 0 |