For example, consider the following code:
Rectangle {
id: idRectParent
Rectangle {
id: idRectChild1
component.onCompleted: {
console.log("Iam Child 1")
}
}
Rectangle {
id: idRectChild2
component.onCompleted: {
console.log("Iam Child 2")
}
}
component.onCompleted : {
console.log("Iam parent Rect")
}
}
I get the output below if I run it in qmlscene(I tried almost 50 times).
Iam parent Rect
Iam Child 2
Iam Child 1
Why is the output in the above order, and not:
Iam parent Rect
Iam Child 1
Iam Child 2
or
Iam Child 1
Iam Child 2
Iam parent Rect
or any other combination.
source
share