[Development] Calling a function at frame-rate before rendering

raskolnikov at es.gnu.org raskolnikov at es.gnu.org
Wed May 14 16:53:03 CEST 2014

Hi guys!

So... I am working on a project where the data model is written in a
functional style and uses a "epochal" approach to move it's state
forward... the details would probably bore you but the important thing is
that it requires a tick() function to be called to make an updated world
state visible.

This seems to be tricky in Qt and I haven't found the best approach yet...
and I am starting to wonder if is even possible at all.

Because following some discussions in this list it seems that animations
are ticked at frame-rate, I tried deriving from QAbstractAnimation and
tick updateCurrentTime(), however, that made the state lag one frame
behind rendering, something quite visible when dragging an object (the Qt
draggable would be updated automatically, but our data-model based stuff
would lag one frame).

Then I tried making an eventFilter() in which I do something like this:

    if (event != MyTickEvent)

I expected this to remove the lagging, but while it improves the
situation, there are cases in which I can still see some lagging.
Furthermore, this approach involves too much ticking, while ticking one
per frame should be enough.

So, am I missing something? Is there a general way to tick my state update
before rendering?



More information about the Development mailing list