Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Threaded Animation
Qt 6.11 is out! See what's new in the release blog

QML Threaded Animation

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 404 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • beeckscheB Offline
    beeckscheB Offline
    beecksche
    wrote on last edited by beecksche
    #1

    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?

    1 Reply Last reply
    0
    • beeckscheB Offline
      beeckscheB Offline
      beecksche
      wrote on last edited by beecksche
      #2

      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 }
          }
      }
      
      1 Reply Last reply
      0
      • beeckscheB beecksche has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved