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

Sze Howe Koh szehowe.koh at gmail.com
Thu Feb 6 14:03:57 CET 2014


On 6 February 2014 19:59, Mark Gaiser <markg85 at gmail.com> wrote:
> On Thu, Feb 6, 2014 at 11:33 AM, Sze Howe Koh <szehowe.koh at gmail.com> wrote:
>> 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 just noticed that as well. On linux it works a lot less stable. Aka,
> i have to start the application about 10x before i finally see one
> where the shader effects (DropShadow in this case) are applied.
>
> Also note that you might have a "sort of shadow". It is by no means a
> shadow. It's just a "copy" of the rectangle in the color set in
> DropShadow. The actual shadow effect (smooth blurred grey.. don't
> really know how to call it) isn't applied.

Bug report time :-D Would you like to do the honours?

Looks like there are two bugs here: 1) Effects don't always get
applied on your Linux machine, and 2) DropShadow's doesn't work
properly (on Rectangles?)

I didn't notice the lack of blurriness until you mentioned it -- never
used DropShadow myself.


Regards,
Sze-Howe



More information about the Interest mailing list