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. Partially transparent image

Partially transparent image

Scheduled Pinned Locked Moved QML and Qt Quick
imagetransparentembedded qtquick
4 Posts 2 Posters 2.6k Views
  • 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.
  • J Offline
    J Offline
    jimmy274
    wrote on last edited by
    #1

    Hi all,

    I need an image to be partially transparent in Qt.Quick (i.e. just a quarter of a certain jpg/png image) and I'm looking through the documentation but can't really find anything useful. Is this at all possible in any way? Maybe some sort of 'void' Window or similar?
    I need it for background image which should be transparent partially (let's say lower left corner - 2-dimensional cropping anyway) if a user goes to a certain menu, otherwise it should be normal without transparent parts. Of course I can crop it manually, but that really isn't very good for my application - different screen resolutions would require me to crop the images independently for each resolution and configuration, which really makes no sense to do.

    If someone knows, please share. Thanks in advance!

    p3c0P 1 Reply Last reply
    0
    • J jimmy274

      Hi all,

      I need an image to be partially transparent in Qt.Quick (i.e. just a quarter of a certain jpg/png image) and I'm looking through the documentation but can't really find anything useful. Is this at all possible in any way? Maybe some sort of 'void' Window or similar?
      I need it for background image which should be transparent partially (let's say lower left corner - 2-dimensional cropping anyway) if a user goes to a certain menu, otherwise it should be normal without transparent parts. Of course I can crop it manually, but that really isn't very good for my application - different screen resolutions would require me to crop the images independently for each resolution and configuration, which really makes no sense to do.

      If someone knows, please share. Thanks in advance!

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @jimmy274 Perhaps you should try OpacityMask from Graphical Effects.

      157

      J 1 Reply Last reply
      1
      • p3c0P p3c0

        @jimmy274 Perhaps you should try OpacityMask from Graphical Effects.

        J Offline
        J Offline
        jimmy274
        wrote on last edited by
        #3

        @p3c0 Hey thanks, it wasn't a perfect fit, but you've pointed me in the right direction (Graphical Effects) - ThresholdMask is what I needed. It's also not a completely perfect fit, but then again, I'm still experimenting with it.

        Either way, thanks big time, really cool pointer!

        p3c0P 1 Reply Last reply
        0
        • J jimmy274

          @p3c0 Hey thanks, it wasn't a perfect fit, but you've pointed me in the right direction (Graphical Effects) - ThresholdMask is what I needed. It's also not a completely perfect fit, but then again, I'm still experimenting with it.

          Either way, thanks big time, really cool pointer!

          p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          @jimmy274 You're Welcome :)
          A more interesting way but through C++ would be to use QQuickPaintedItem to create your own custom item. You can re-implement paint method to draw your custom shapes, text etc.. It uses QPainter to achieve this. Try looking for setCompositionMode and setClipRegion methods. An example for QQuickPaintedItem is here.

          157

          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