QML Threaded Animation
Solved
QML and Qt Quick
-
Hi,
My QML application is executed with in a threaded render loop, the log (qt.scenegraph.general) shows:threaded render loop Using sg animation driver
Sample QML code
Button { text: "Run Blocking Function in C++" onClicked: { myRotationAnimation.running = true; MyObjectInCpp.start(); } } Rectangle { width: 50 height: 50 radius: 25 Image { id: reloadImage anchors.centerIn: parent source: "qrc:/images/refresh-line.svg" sourceSize.width: 25 sourceSize.height: 25 RotationAnimation { id: myRotationAnimation target: reloadImage from: 0 to: 360 duration: 1000 loops: Animation.Infinite } } }
Nevertheless, the rotation animation is not displayed correctly. The rotation starts after the blocking function was called.
This should be discussed in the blog post/video https://www.qt.io/blog/2012/08/20/render-thread-animations-in-qt-quick-2-0.
Am I interpreting the threaded loop incorrectly or do I need to activate something else?
-
A different image, but same effect. Fixed it with the BusyIndicator class.
Button { text: "Run Blocking Function in C++" onPressed: busyIndicator.running = true onClicked: MyObjectInCpp.start() } BusyIndicator { id: busyIndicator running: false Connection { target: MyObjectInCpp function onFinished() { busyIndicator.running = false } } }
-
B beecksche has marked this topic as solved on