I have MyType
registered as qmlRegisterSingletonType<MyType>("org.examples", 1, 0, "MyType")
which has QmlListProperty<MyListElement>
- myList
.
What syntax i should use at QML side to assign something to MyType.myList
?
Seems like that is incorrect:
Component.onCompleted: {
MyType.myList = [
MyListElement {
}
]
}
You have to create the MyListElement object using javascript and then add it to the list with push since QmlListProperty is translated to a list in QML.
In this case with
Qt.createQmlObject()
, so assuming MyListElement was created with:So the solution is: