From kde-panel-devel Mon Feb 23 19:56:51 2009 From: Toussis Manolis Date: Mon, 23 Feb 2009 19:56:51 +0000 To: kde-panel-devel Subject: Re: plasma::applet painter Message-Id: <200902232156.52141.manolis () koppermind ! homelinux ! org> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=123541905520430 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============2034524786==" --===============2034524786== Content-Type: multipart/alternative; boundary="Boundary-00=_E+voJ/NfA0sWsC0" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-00=_E+voJ/NfA0sWsC0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit 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. --Boundary-00=_E+voJ/NfA0sWsC0 Content-Type: text/html; charset="iso-8859-15" Content-Transfer-Encoding: 7bit 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.



--Boundary-00=_E+voJ/NfA0sWsC0-- --===============2034524786== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============2034524786==--