[Interest] Draw a shadow around a Rectangle using DropShadow. Should be possible, right?

Sze Howe Koh szehowe.koh at gmail.com
Thu Feb 6 11:33:10 CET 2014


On 5 February 2014 23:35, Mark Gaiser <markg85 at gmail.com> wrote:
> I can't get it to work with a rectangle..
>
> import QtQuick 2.0
> import QtGraphicalEffects 1.0
>
> Rectangle {
>     width: 800
>     height: 600
>
>     DropShadow {
>         horizontalOffset: 3
>         verticalOffset: 3
>         radius: 16
>         samples: 24
>         color: "#80000000"
>         width: blackRect.width
>         height: blackRect.height
>         anchors.centerIn: parent
>
>         Rectangle {
>             id: blackRect
>             width: 500
>             height: 50
>             color: "black"
>         }
>     }
> }

Works for me. I copied your code exactly; you can see the result in
the attachment.

I'm using Qt 5.2.1, MSVC 2012 x64, OpenGL.


Regards,
Sze-Howe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dropshadow.png
Type: image/png
Size: 4895 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140206/8d00553f/attachment.png>


More information about the Interest mailing list