You should check, when do you the call myCBox.find
, look at this code:
ComboBox {
id: myCBox
model: [ "1.5", "2", "2.5", "3", "3.5", "4", "5", "6", "7", "8", "9" ]
Component.onCompleted: {
console.log("After this line it should work fine.");
}
Item {
Component.onCompleted: {
console.log("myCBox is not completed:", myCBox.find("5"));
}
}
}
Component.onCompleted: {
console.log("myCBox here must be completed:", myCBox.find("5"));
}
and the output:
myCBox is not completed: -1
After this line it should work fine.
myCBox must be completed: 6
Uppon creation, Component
creates all items and then arranging them in a tree. From the most inner object, it updates properties and bindings to the most overrided value and calls attached method Component.onCompleted
.