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. A semi-transparent Rectangle that also blurs

A semi-transparent Rectangle that also blurs

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 4 Posters 10.3k 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.
  • K Offline
    K Offline
    kersson
    wrote on last edited by
    #1

    In QML, you can create a Rectangle with a semi-transparent background color that partially shows what is underneath it. This is great for creating slide-out panels that let the user still get a sense of what is underneath.

    Is it possible to also add a blurring effect in addition to the transparency? Much like some of the "panels in iOS 7":http://media.heavy.com/media/2013/09/ios-7-battery-tips-wifi-bluetooth.jpg. I'm guessing that this could be done by applying a ShaderEffect, but using ShaderEffect requires providing a "src" component. However, I'd like the Rectangle to blur what's underneath more generally. That is, without any knowledge of or references to the items that are underneath it.

    Any thoughts on how this would be achieved?

    1 Reply Last reply
    1
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Yes, it is possible and quite easy: check out "Qt Graphical Effects":http://www.ics.com/blog/qt-graphical-effects-module#.Uw2S-kddUs0.

      (Z(:^

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kersson
        wrote on last edited by
        #3

        Thanks for the link. I'm aware of the GraphicalEffects module. Yes, it's easy to blur an image, but I'm talking about blurring an arbitrary section of any QML UI. For example, imagine a QML scene with a draggable Rectangle that floats on top of the scene. I want to have that Rectangle blur anything that lies beneath it.

        The Blur effects require a "source" component to which to apply the blur, but in my example there is no single source component. The Rectangle could overlap with any item in the scene.

        Hopefully this makes sense?

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          No, I still think it is doable using FastBlur and friends. I have definitely used that to blur my whole UI using a Rectagle. If it would also work for a dynamic, draggable Rectangle: I am not sure, you would need to try.

          (Z(:^

          1 Reply Last reply
          0
          • A Offline
            A Offline
            atemple
            wrote on last edited by
            #5

            This post was about a year ago, yet it never got answered... I'm also very curious if there's a QML solution to apply a blur WITH transparency. Yes, you can use FastBlur and friends to blur from a source, but how do you ALSO make it transparent? That is, when an item comes IN BETWEEN the background source item you're blurring against AND the foreground item you want blurred, have the blurred image reflect that item in between the two layers. Kersson's screenshot clearly shows an example of how iOS makes this effect.

            I've always had to sacrifice the blur or transparency, so I'm curious if anyone has found a way to do both with QML. Maybe some sort of color that acts as a blur?

            1 Reply Last reply
            0
            • A Offline
              A Offline
              atemple
              wrote on last edited by
              #6

              Just as a followup to this, I found an example of the behavior we are looking for in CSS and javascript.

              http://codepen.io/rikschennink/details/zvcgx

              1 Reply Last reply
              1
              • I Offline
                I Offline
                Iktwo
                wrote on last edited by
                #7

                Is this what you want? http://pastebin.com/VgTuzSY6

                it looks like this
                Alt text

                The project with images:
                http://dropcanvas.com/r1r73

                1 Reply Last reply
                2

                • Login

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