Hi,
ok, but then I don’t understand why the following line in a js statement is a static assignment and not a property binding:
Button
{
mousearea.onClicked:
{
image.source = mousearea.pressed ? "imgPressed.png" : "img.png"
}
}
I mean, when I use this line outside of the js statement using the colon “:”, the binding works perfectly:
{
image.source: mousearea.pressed ? "imgPressed.png" : "img.png"
mousearea.onClicked:
{
}
}
Also, when I try to use the colon “:” in the js statement like this:
{
mousearea.onClicked:
{
image.source: mousearea.pressed ? "imgPressed.png" : "img.png"
}
}
, then QtCreator throws an error and doesn’t compile my code…
In the link you posted, I read that the “imperative assignment operator” “=” is a JAVASCRIPT operator, so does that mean that I can use “=” only in JAVASCRIPT statements (like onClicked: {} in the above example)?
If yes, then I’m still wondering why the code in example 1 (this post) doesn’t bind the property value but instead overwrites (a previous existing) binding with a fixed value, either imgPressed.png or img.png…
Do you know why?
↧









