Solved Execute function when value of variable changes.
-
Hello, is there a way in QML to execute a function when the value of a variable changes?
-
hi @viktorp
Yes it is. That is a fundamental concept.
every property has its onPropertyNameChanged handler.
every property you will declare + all the default properties of QML Types (Item/Rectangle/Image/Button...) work like that.
property int myVar : 5 onMyVarChanged : { console.log(myVar) } Rectangle{ height : 50 onHeightChanged : { /*call function*/} }
-
Thank you very much! I missed that one :)