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;
}
}
}
↧










