Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    QML and Qt Quick
    2
    3
    3653
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      Fenix Voltres last edited by

      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.
      [/quote]

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

      When temptation brings me to my knees
      And I lay here drained of strength
      Show me kindness
      Show me beauty
      Show me truth

      1 Reply Last reply Reply Quote 0
      • Z
        ZapB last edited by

        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]

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply Reply Quote 0
        • F
          Fenix Voltres last edited by

          Thank you, your idea works. :)

          When temptation brings me to my knees
          And I lay here drained of strength
          Show me kindness
          Show me beauty
          Show me truth

          1 Reply Last reply Reply Quote 0
          • First post
            Last post