It won't work --- you take x and y values from an uninitialized object.
When you use startTimer(), you have to reimplement QObject::timerEvent() and put the code that you want to run every second there.
You need something like:You can also consider using QTimer instead of startTimer()/timerEvent().Qt Code:
{ Q_UNUSED( e); scene->advance(); }To copy to clipboard, switch view to plain text mode
To make scene->advance() work, you have to reimplement QGraphicsItem::advance() in your Container class or use QGraphicsItemAnimation.
P.S. Please, don't post the same question twice in two different threads.





Reply With Quote
Bookmarks