I have an item which I've turned into a button with animations based on different states. The problem is, sometimes that button will be disabled and then I want it to have a semi-transparent foreground color to basically shade it out and signify that the button is disabled. Is there a way to do that to a QML Item?
CodePudding user response:
If I understand your question correctly, you just need to add a Rectangle that is only visible if your button is disabled.
Item {
id: button
Rectangle {
anchors.fill: parent
color: "red"
opacity: 0.3
z: 2 // <-- Make sure it stays on top of the rest of the content
visible: !button.enabled
}
}