ListModel in qml, getting objects from model
qml, qt
Solution
When you append your `Project` object to the ListModel, it is the properties of `Project` object being added to the ListModel (as ListModel roles), not the `Project` object itself. So, when you use `ListModel.get()`, the return object is just a object (QObject* to be exact) with the ListModel roles as properties, but not the `Project` object.
To be more simple, ListModel is not a container for your `Project` object. It just store the properties of your `Project` object.
Problem
I have a ListModel that I fill in the following way: ``` property ListModel projects: ListModel {} property Project currentProject : null function initialization(){ var comp = Qt.createComponent("Project.qml"); var object = comp.createObject(parent,{}); projects.append(object); currentProject = projects.get(0) } Component.onCompleted: root.initialization(); ``` And I have a error in `currentProject = projects.get(0)` line. Error text: ``` main.qml:14: Error: Cannot assign QObject* to Project_QMLTYPE_0* ```