Hi guys, I really need a little bit of help on this one
I need to make a QPainter fillrect have some animation but I can´t get it.
if someone know a very easy way to make this happen, please let me know
Hi guys, I really need a little bit of help on this one
I need to make a QPainter fillrect have some animation but I can´t get it.
if someone know a very easy way to make this happen, please let me know
I guess this will help you
smarinr (29th April 2008)
let me show you my code:
I don´t understand too much about Qpixmap, QBRUSH or QPAINTER.. but this code frag is what show a profile bar when you click somethingQt Code:
if (_currentLabel) { painter.fillRect(r, brush); painter.end(); } else { } }To copy to clipboard, switch view to plain text mode
Last edited by jpn; 29th April 2008 at 19:46. Reason: missing [code] tags
Oh... you probably mean a gradient? Take a look at QLinearGradient.
smarinr (29th April 2008)
no Gradient... let me think how I can show you more exactly what am I doing
ok, here is what I need to do
you see that the code makes a QRect, take a QPixmap and put it on the QBrush and calls the QPainter to start painting fillRect()
that part is on the IF condition, but...
see the ELSE condition...
the part make a not good looking disappear of what we already paint...
so... in few words, my goal to achieve is that the ELSE dont make the rude changing on the UI, make it look like its disappearing little by little....
I dont know if someone understand that...
You can use QPainter::setOpacity(). You will have to make the opacity smoothly reduce from 1.0 to 0.0 instead of a "_currentLabel" flag which can only have two states.
J-P Nurmi
smarinr (29th April 2008)
But you will still need to animate the fade yourself using some timer. Read this:
http://doc.trolltech.com/qq/qq16-fader.html
smarinr (29th April 2008)
Bookmarks