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. Blur effect for Rectangle

Blur effect for Rectangle

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 4.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.
  • F Offline
    F Offline
    freddy311082
    wrote on 6 May 2014, 17:07 last edited by
    #1

    Hi guys... I need to put a blur affect to a rectangle qml object. I saw the example about FastBlur effect, but it's work only for images... my code look like this and it's doesn't work:

    @
    Rectangle{
    id: root
    color: "transparent"
    border.width: 2
    border.color: "black"
    radius: 18

    Rectangle{
        id: rectSection
        width: parent.width - parent.border.width * 2
        x: parent.border.width
        height: parent.height - parent.border.width * 2
        y: parent.border.width
        color: "#070707"
        anchors.top: parent.top
        anchors.topMargin: parent.border.width
        opacity: 0.4
        radius: 16
    }
    
    FastBlur{
        id: blur
        anchors.fill: root
        radius: 8
        source: rectSection
    }
    

    }
    @

    how can I adda blur effect to a rectangle qml object ??

    best regards

    Freddy

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 7 May 2014, 12:44 last edited by
      #2

      Check out the console output. Are there any errors? I think it is wrong to mix anchoring and fixed coords in a Rectangle (rectSection). So maybe your rectangle is not being drawn at all.

      (Z(:^

      1 Reply Last reply
      0
      • F Offline
        F Offline
        freddy311082
        wrote on 7 May 2014, 16:42 last edited by
        #3

        Thanks sierdzio

        well, my real problem y that I have my movie application, and I have a rectangle which apear sometimes... when my rectangle appear, this rectangle has a 0.7 of opacity, and I need the blur affect only under the part which is under my rectangle...

        how can I do that ??? that is my real problem !!!

        because the rectangle can be in any place over my application, so, I can't have an exactly component as source....

        any idea about how can I do that ??

        regards

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 7 May 2014, 16:53 last edited by
          #4

          [quote author="freddy311082" date="1399480977"]because the rectangle can be in any place over my application, so, I can't have an exactly component as source....[/quote]

          That has nothing to do with the blur effect, it still needs to be applied over your semi-transparent rectangle. Best option is to make it fill it's parent. And if you need to place it in an arbitrary place, then do that with the base Rectangle, not with the blur.

          In any case, please check the console log. I am almost certain the QML engine is printing some errors because you are mixing anchors and fixed coordinates. In that case, don't be surprised it does not work ;-)

          (Z(:^

          1 Reply Last reply
          0

          1/4

          6 May 2014, 17:07

          • Login

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