Использование setSource()
:
// example.qml
import QtQuick 2.0
Item {
Loader {
id: squareLoader
onLoaded: console.log(squareLoader.item.width);
// prints [10], not [30]
}
Component.onCompleted: {
squareLoader.setSource("ExampleComponent.qml",
{ "color": "blue" });
// will trigger the onLoaded code when complete.
}
}