[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: plasma::applet painter
From:       Toussis Manolis <manolis () koppermind ! homelinux ! org>
Date:       2009-02-23 19:56:51
Message-ID: 200902232156.52141.manolis () koppermind ! homelinux ! org
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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.



[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" \
content="1" /><style type="text/css">p, li { white-space: pre-wrap; \
}</style></head><body style=" font-family:'Arial'; font-size:11pt; font-weight:400; \
font-style:normal;">On Saturday 21 February 2009 20:31:10 Aaron J. Seigo wrote:<br> \
&gt; On Saturday 21 February 2009, Toussis Manolis wrote:<br> &gt; &gt; Thank you \
very much on answering my question.<br> &gt; &gt;<br>
&gt; &gt; On Saturday 21 February 2009 18:34:27 Aaron J. Seigo wrote:<br>
&gt; &gt; &gt; On Saturday 21 February 2009, Toussis Manolis wrote:<br>
&gt; &gt; &gt; &gt; I want to add some effect to an applet<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; what effect are you trying to achieve? because while you ask how to \
get<br> &gt; &gt; &gt; a pixmap of your widget, depending on what effect you are \
trying to<br> &gt; &gt; &gt; achieve that may not be what you actually want to be \
doing.<br> &gt; &gt;<br>
&gt; &gt; I was thinking of implementing a fadout effect of the old snapshot of \
the<br> &gt; &gt; applet.<br>
&gt; &gt; I need the QPixmap to draw it with Opacity degrading from 1.0 to 0.0 \
...<br> &gt;<br>
&gt; QGraphicsItem::setOpacity(qreal)<br>
&gt;<br>
&gt; an easy way to achieve what you want is to implement the contents of your<br>
&gt; applet as a QGraphicsWidget subclass (rather than painting directly into<br>
&gt; your applet). make this child item non-movable and set its size to be the<br>
&gt; same as your widget (can be done on SizeConstraint in constraintsEvent, or<br>
&gt; you can override resizeEvent but be sure to call Applet::resizeEvent in<br>
&gt; that case!).<br>
&gt;<br>
&gt; then have two of these items; when doing the transition, show both but one<br>
&gt; with a high opacity and the other with a the inverse value and adjust the<br>
&gt; opacity on both. finally, hide or delete the one that is "going away".<br>
&gt; voila.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>You are right about using QGraphicsWidgets to draw my \
applet.<br> It could be much easier to implement the graphics \
placement/drawing/animation.<br> I will use it next time.<br>
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. :-)<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>Thanks again for the proposals.<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p><p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p></body></html>



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic