Potential new component for Plasma QML components: ShadowEffect

Aurélien Gâteau agateau at kde.org
Thu Apr 4 07:20:06 UTC 2013


Hi,

I would like to propose a new component for Plasma QML components:
ShadowEffect.

This component has been created for Homerun and is used to show a shadow
behind texts when Homerun is used as a containment.

It is similar to the QGraphicsDropShadowEffect which comes with Qt, but
provides a more visible shadow (QGraphicsDropShadowEffect shadow is hardly
visible when one sets the blurRadius to anything higher than 2). It uses
Plasma::PaintUtils::shadowBlur() to render the shadow, painting it twice
to ensure it is visible.

It is also capable of automatically picking a shadow color based on the
item color. This comes at the price of duplicating some internal Qt code
though, as can be seen in the .cpp file.

The code currently lives in Homerun repository. You can have a look at it
here:

https://projects.kde.org/projects/playground/base/homerun/repository/revisions/master/entry/components/shadoweffect.h
https://projects.kde.org/projects/playground/base/homerun/repository/revisions/master/entry/components/shadoweffect.cpp

I put together a short QML test demonstrating how to use it, attached to
this email. It looks like this:

http://wstaw.org/m/2013/04/03/plasma-windowedP23222.png

Is this something you would be interested to have in Plasma QML
components?

Aurélien

-------------- next part --------------
A non-text attachment was scrubbed...
Name: shadow-demo.qml
Type: application/octet-stream
Size: 2535 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20130404/5f63c22f/attachment-0001.obj>


More information about the Plasma-devel mailing list