我有一个 ListModel,我按以下方式填写:
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();
而且我有一个错误currentProject = projects.get(0)
。错误文字:
main.qml:14: Error: Cannot assign QObject* to Project_QMLTYPE_0*