Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Changing button image loses pressed signal

$
0
0
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?

Viewing all articles
Browse latest Browse all 4972

Latest Images

Trending Articles



Latest Images