No Opacity on top of Opacity
-
I have a rectangle with an opacity of 0.4. I want a button on top of it that has no opacity at all (basically, an opacity that cancel the 0.4 below it). Is it possible ?
I tried to use opacity of 1 for the button but it's like saying: I want full opacity of the background layer…which is 0.4.Thanks
Bidochon
-
Hi,
The opacity of an item will always be passed down to its children. Your button must be put outside your half-opaque rectangle.
Do something like this:
@
Rectangle {
id: containerRectangle
width: 800
height: 600
color: "transparent"Rectangle { id: realRectangle anchors.fill: parent color: "green" opacity: 0.4 } Button { anchors.centerIn: parent text: "Click Me!" }
}
@ -
Of course! How come I didn't think about this ?
Thanks .ps: That's why I shouldn't be allowed to post anything on Friday !
Bidochon
-
You're welcome!
P.S. It's possible ;) http://www.troll.me/2012/01/24/uncategorized/late-night-coding-zero-build-errors/