Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.7.2
-
None
Description
Unlike ListView (which works fine), the Repeater{} does not update when data in ListModel are changed...
ListModel { id: myModel ListElement { name: "Apple" cost: 2.45 } ListElement { name: "Orange" cost: 3.25 } ListElement { name: "Banana" cost: 1.95 } } Column { Repeater { model: myModel spacing: 5 Rectangle { width: 20 height: 50 color: "yellow" required property int index Label { anchors.left: parent.left anchors.top: parent.top text: myModel.get(index).name } Label { anchors.right: parent.right anchors.top: parent.top text: myModel.get(index).cost } MouseArea { onClicked: myModel.setProperty(index, "cost", 5); // this shall update the and show me new price } } } }
again, same inside ListModel works just fine and Text{} property updates... so only Repeater is not working here...
there are several stuff people reported this (same or similar?) issue before:
QTBUG-28556 Repeater does not refresh role names on model reset - Qt Bug Tracker
QTBUG-32132 Qml do not updates roles names on QAbstractItemModel::reset signal - Qt Bug Tracker
[Interest] QML Repeater delegate not updating (qt-project.org)
[updating elements in a repeater? | Qt Forum|https://forum.qt.io/topic/124628/updating-elements-in-a-repeater/4]
there is no mention in the documentaion that it should not update, tho people suggest to use .clear() and append() all of it back... which is nightmare solution :/