Debian Codegraph @

tests/auto/qml/qqmllistmodel/data/dynamicroles.qml

raw
1 import QtQuick 2.0
2
3 Item {
4 id: root
5
6 ListModel {
7 id: listModel
8 objectName: "listModel"
9 dynamicRoles: true
10
11 // have to add elements dynamically when dynamicRoles = true
12 function appendNewElement() {
13 listModel.append({"name": "test", "obj": null})
14 }
15
16 function setElementAgain() {
17 var element = listModel.get(0)
18 listModel.set(0, element)
19 }
20 }
21 }