PDA

View Full Version : Animate drawing



ogh
16th June 2011, 18:37
Hi,
I'd like to build some kind of slide show framework upon qt and am currently doing research on how to do it. Since I want to be able to let things move around I figured that QGraphicsItems which are kept in a QGraphicsScene and displayed in a QGraphicsview might be the right choice.
There is a wide variety of implementations like QGraphicsEllipseItem, QGraphicsLineItem, ... already available. This totally satisfies my needs.

However there is one thing I don't know how to realize.
I'd like to let e.g. a path literally to be drawn.
Like one would do it with a pencil, millimeter by millimeter.
I cant find a suitable property of QGraphicsPathItem or QPainterPath which allows me to animate the drawing.

I guess I will have to build a solution by myself by inheriting some classes.

Can anyone point me in the right direction?
Which classes do i have to inherit, which functions to override?

Thanks in advance,
best regards,

ogh

wysota
16th June 2011, 19:11
Have a vector of control points and in each step add one more point from the vector to the path you draw. Of course you need many points for the path to be smooth.

ogh
16th June 2011, 19:35
Thanks a lot.
I'll try that and am going to report about the performance as soon as I get it running.