plasma::applet painter

Toussis Manolis manolis at koppermind.homelinux.org
Mon Feb 23 20:56:51 CET 2009


On Saturday 21 February 2009 20:31:10 Aaron J. Seigo wrote:
> 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.

You are right about using QGraphicsWidgets to draw my applet.
It could be much easier to implement the graphics placement/drawing/animation.
I will use it next time.
For the specific applet I wrote it from the beginning with drawing over it, 
and it is not such a big project to re implement it , the clean way. :-)

Thanks again for the proposals.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20090223/0775cf8d/attachment.htm 


More information about the Plasma-devel mailing list