GOT IT.
this worked:
onClicked: {
var component = Qt.createComponent("master_item.qml");
if (component.status == Component.Ready) {
var tab = tabview.addTab("tab " + (tabview.count + 1), component);
if (tab.status == Loader.Ready) {
tab.item.obj = products.get("CR2001W");
} else {
tab.loaded.connect(function() {
console.log("this will be executed when corresponding tab is on focus");
if (tab.status == Loader.Ready) {
tab.item.obj = products.get("CR2001W");
}
});
}
}
}
by extension, I should be putting callbacks on component.statusChanged as well… this gets ugly pretty fast. Refactor this on different JS file? how about my Products factory object? will it be available from js? Can I even put imports in plain js?
↧