Render Thread Animations in Qt Quick 2.0
August 20, 2012 by Gunnar Sletta | Comments
One of the shortcomings of the Qt Quick API is that despite having a dedicated rendering thread, our animations are always running on the GUI thread.
Running animations outside the application's main thread has the advantage that it greatly reduces jerkyness as operations that block the main thread will not hinder the animations from running.
There are three primary problems hindering us:
- Animations update properties and these are tied to QObjects and the meta object system. To avoid threading insanity, we can only read and write these on the GUI thread.
- Properties often have bindings in QML, which trigger JavaScript execution which must happen on the GUI thread.
- The threaded render loop in the QtQuick library is driven by the GUI thread and does not redraw unless told, so if the GUI is blocked, nothing updates.
As I mentioned in my previous post, the render loop in the "customcontext" in ssh://codereview.qt-project.org:29418/playground/scenegraph.git fixes the third problem, but that leaves the issue of access to QObjects and JavaScript execution.
A colleague of mine, Marko Niemelä, has been working on an animation system that solves the QObject / QML binding part. His work is in the "animators" directory of the playground repository.
This is not Qt 5.0 material, but maybe we can get it in good shape for 5.1.
Enjoy!
Blog Topics:
Comments
Subscribe to our newsletter
Subscribe Newsletter
Try Qt 6.5 Now!
Download the latest release here: www.qt.io/download.
Qt 6.5 is the latest Long-Term-Support release with all you need for C++ cross-platform app development.
Explore Qt World
Check our Qt demos and case studies in the virtual Qt World
We're Hiring
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.Henkilön Qt (@theqtcompany) jakama julkaisu