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

[Solved] QML Button Color doesn't change when Button is Clicked

$
0
0
Hello everyone, I have defined a custom button in QML, and it was changing the color when pressed, until I added a mouseArea, which onClicked calls a function. Then the color does not change anymore. However I can change the other parameter ie the radius. Any ideas why this happens? Button {     id: "myButton";     text: "btnTxt";         signal buttonClick();       onButtonClick: {         console.log("Button "+ myButton.id +" is clicked!")     }       MouseArea {         anchors.fill: parent         onClicked:         {             myButton.buttonClick();         }     }       style: ButtonStyle {                             background:                               Rectangle {                             color: control.pressed ? "#336699" : "#0099FF";                             radius: 1;                             }                } }

Viewing all articles
Browse latest Browse all 4972

Latest Images

Trending Articles



Latest Images