How to know if a property has a property binding?
-
Is there a way to know if a property has a property binding or is just a constant?
For example, the following binds object.x to root.x:
@
Window {
id: root
x: object.x
}
@When a button is clicked, root.x holds a constant:
@
Button {
onClicked: {
root.x = 100
}
}
@So how do we check if root.x is currently bound to object.x or is just a constant without binding?
-
There is no direct way to check it. In the current case you are assigning the static value to root.x. In that case binding will be removed. Even if the object.x changes, root.x will remain constant. May be you can check for onXChanged signal handler see if it is called. If signal handler called means value is getting changed. These are simple work-around with side effects. ie. no full proof solution.
-
Thanks. I think manually setting a bool flag when the code changes between binding and constant will do too.