更新时间:2022-12-15 19:10:35
根据mouli@irc.freenode.net#qt的建议,请执行以下操作:
Due to advice from mouli@irc.freenode.net#qt do this:
file:gui.qml
file: gui.qml
import "script.js" as Script
model: ListModel { id: list_model_id }
file:script.js
file: script.js
function makeList(id){
id.append({"name":"value1"});
id.append({"name":"value2"});
}
致电:
Script.makeList(list_model_id)