Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. No Opacity on top of Opacity
Forum Updated to NodeBB v4.3 + New Features

No Opacity on top of Opacity

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 904 Views 1 Watching
  • 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.
  • B Offline
    B Offline
    Bidochon
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      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!"
      }
      

      }
      @

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bidochon
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          You're welcome!

          P.S. It's possible ;) http://www.troll.me/2012/01/24/uncategorized/late-night-coding-zero-build-errors/

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved