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

raskolnikov at es.gnu.org raskolnikov at es.gnu.org
Wed May 14 20:39:45 CEST 2014


Thank you a lot, that is a very comprenhensive response.

> If you have GUI thread state, application logic and other stuff you can
> call QQuickItem::polish() and reimplemnt QQuickItem::updatePolish() which
> is called just before the QML tree is synced into the render thread.

Indeed, this is GUI thread state and this update potentially updates QML
properties, whose state we want visible before synching to the state
thread. This seems reasonably the best approach, but when can I call
polish?

> If you have continuous animations use QAbstractAnimation and use the time
> you get in updateCurrentTime().

I did this, but then the state update seems to lag one frame behind. The
problem looks like this:

                                 next
Touch Input   ->   Render  -> updateCurrentTime  ->   Render
    \                              \
     \                              \
      \                              \     Depndent properties
     Set some property                \      /  update
        \                              \    /
         \                              \  /
          \                              \/
        State update                 State update
        Scheduled                    Comitted

I wonder, if there is a way to commit the state before the first render,
so dependent properties don't seem to lag. The problem with calling
polish() explicitly is that the component that ticks the state and the
ones that modify the state are unrelated. Maybe, is there a way to mark a
component as always dirty needing polish?

JP





More information about the Development mailing list