In situations such as this it is wise to use a Component.onCompleted handler to make sure the other method only gets executed when the object is fully constructed:
Item {
property var prop
property var prop2
property bool __constructed: false
onPropChanged: {
if(!__constructed) return
doSomethingWith(prop2)
}
Component.onCompleted: {
__constructed = true
// do some other initial stuff
}
}
Item {
property var prop
property var prop2
property bool __constructed: false
onPropChanged: {
if(!__constructed) return
doSomethingWith(prop2)
}
Component.onCompleted: {
__constructed = true
// do some other initial stuff
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks