Nominate our 2022 Qt Champions!

[SOLVED] Children's opacity greater than parent's?

  • Is it possible?
    I need to display console with opacity let's say 0.5 with text on it having 1.0, is it possible?

    [quote author="Documentation" date="1301943141"]
    When this property is set, the specified opacity is also applied individually to child items. In almost all cases this is what you want, but in some cases it may produce undesired results.

    but it doesn't say what to do in that particular 'some cases'...

  • My first thought would be to not make the opaque item a child of the transparent one. Instead fake it by positioning it using anchors relative to the semi-transparent item.

    Item {
    Rect {
    id: myRect
    opacity: 0.5

    Text {
        anchors.centerIn: myRect
        text: "I am opaque text"


    [Not tested]

  • Thank you, your idea works. :)

Log in to reply