plasma::applet painter

Aaron J. Seigo aseigo at kde.org
Sat Feb 21 19:31:10 CET 2009


On Saturday 21 February 2009, Toussis Manolis wrote:
> Thank you very much on answering my question.
>
> On Saturday 21 February 2009 18:34:27 Aaron J. Seigo wrote:
> > On Saturday 21 February 2009, Toussis Manolis wrote:
> > > I want to add some effect to an applet
> >
> > what effect are you trying to achieve? because while you ask how to get a
> > pixmap of your widget, depending on what effect you are trying to achieve
> > that may not be what you actually want to be doing.
>
> I was thinking of implementing a fadout effect of the old snapshot of the
> applet.
> I need the QPixmap to draw it with Opacity degrading from 1.0 to 0.0 ... 

QGraphicsItem::setOpacity(qreal)

an easy way to achieve what you want is to implement the contents of your 
applet as a QGraphicsWidget subclass (rather than painting directly into your 
applet). make this child item non-movable and set its size to be the same as 
your widget (can be done on SizeConstraint in constraintsEvent, or you can 
override resizeEvent but be sure to call Applet::resizeEvent in that case!).

then have two of these items; when doing the transition, show both but one 
with a high opacity and the other with a the inverse value and adjust the 
opacity on both. finally, hide or delete the one that is "going away". voila.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090221/62081754/attachment.sig 


More information about the Plasma-devel mailing list