1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
import QtQuick 2.0
Item {
id: root
width: 200
height: 200
property bool success: true
property int loadCount: 0
Loader {
id: loader
anchors.fill: parent
asynchronous: true
active: false
source: "TestComponent.qml"
onLoaded: {
if (status !== Loader.Ready) {
root.success = false;
}
root.loadCount++;
}
}
function triggerLoading() {
// we set active to true, which triggers loading.
// we then immediately set active to false.
// this should clear the incubator and stop loading.
loader.active = true;
loader.active = false;
}
function activate() {
loader.active = true;
}
function deactivate() {
loader.active = false;
}
function triggerMultipleLoad() {
loader.active = false; // deactivate as a precondition.
loader.source = "BlueRect.qml"
loader.active = true; // should trigger loading to begin
loader.source = "RedRect.qml"; // should clear the incubator and restart loading
}
}
|