[Qt-interest] Animation with QGraphicsView

Freddie Witherden freddie at witherden.org
Sat May 2 13:39:04 CEST 2009


Hi all,

My application uses QGraphicsView to model a physical system, in which  
the position of objects (x,y) is a function of time. Currently my  
application works by using a timer set to fire every m_timeStep  
milliseconds and calling scene()->advanced() in the timer event.

This causes each simulated object to advance by m_timeStep and update  
its position. The problem is that if the system is unable to keep  
manage 60 advances a second the simulation lags. Obviously this is not  
the right way to go about it.

While it is not hard to de-couple the two, so we get the amount of  
time passed since the last update and add that to get the current  
simulation time. (As the simulation can be paused.)

However, what is the best way to get Qt to try and pump out as many  
frames as possible. There has to be a better way than a timer.

Regards, Freddie.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090502/84da2423/attachment.bin 


More information about the Qt-interest-old mailing list