PDA

View Full Version : fade from one colour to another



panduro
11th June 2008, 11:01
Hi

A small question, from a QT newbie.

I have a small box painted in the painEvent, and I want the colour to fade from one colour to another, over time.

I hope someone have an idea how to do this.

Thanks :)
Søren- DK.

jacek
12th June 2008, 02:09
First you need a QTimer or QTimeLine that will fire QWidget::update() (or a custom slot which calls update()). The second thing you need to do is to change paintEvent() so that it reads the current state of the animation from somewhere and paints it. The last thing is to keep change the state somehow.

Note that you shouldn't update the animation state in paintEvent() because you can never know when it will be called.

panduro
18th June 2008, 14:30
Thanx..

Søren - DK