Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QtQuick 2 animation performance issue

    QML and Qt Quick
    3
    6
    1456
    Loading More Posts
    • 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.
    • D
      dvolosnykh last edited by

      Consider example below:

      @
      import QtQuick 2.0

      PathView {
      width: 1280
      height: 720
      cacheItemCount: 7
      pathItemCount: 7
      preferredHighlightBegin: 0.5
      preferredHighlightEnd: 0.5
      model: ListModel {
      ListElement {
      color: "orange"
      text: "first"
      }
      ListElement {
      color: "lightgreen"
      text: "second"
      }
      ListElement {
      color: "orchid"
      text: "third"
      }
      ListElement {
      color: "tomato"
      text: "fourth"
      }
      ListElement {
      color: "skyblue"
      text: "fifth"
      }
      ListElement {
      color: "hotpink"
      text: "sixth"
      }
      ListElement {
      color: "darkseagreen"
      text: "seventh"
      }
      ListElement {
      color: "salmon"
      text: "eightth"
      }
      ListElement {
      color: "darkolivegreen"
      text: "nineth"
      }
      ListElement {
      color: "navy"
      text: "tenth"
      }
      }
      delegate: Item {
      width: 150
      height: 150

          Rectangle {
              id: rect
              anchors.fill: parent
              color: model.color
              opacity: 0.8
          }
      
          Text {
              anchors.centerIn: parent
              text: model.text
              color: "white"
              font.pixelSize: 24
          }
      }
      path: Path {
          startX: -150
          startY: height / 2
          PathLine {
              x: width + 150
              relativeY: 0
          }
      }
      
      NumberAnimation on offset {
          from: 0
          to: count
          loops: Animation.Infinite
          duration: 4000
          Component.onCompleted: start()
      }
      

      }
      @

      The animation is jerky for Qt versions 5.1.1 and 5.3.2 (Ubuntu 14.04), and 5.2.1 (embedded Linux). I guess, this is the garbage collector affecting performance, but since UI structure does not change such suggestion might be irrelevant. Is there anything can be done to make animation run smoothly?

      1 Reply Last reply Reply Quote 0
      • Gianluca
        Gianluca last edited by

        Strange usage of "offset" property. From what I know should be used only for setting the initial configuration of the PathView.
        Try to animate the currentIndex property.

        1 Reply Last reply Reply Quote 0
        • D
          dvolosnykh last edited by

          Interesting, I don't experience this issue on Mac OS X 10.10.

          1 Reply Last reply Reply Quote 0
          • T
            Torgeir last edited by

            This seems smooth to my eyes in both Windows 7 and Kubuntu 14.10.

            Is the jerkyness very subtle? If not, can you check if any processes are possibly loading your CPU? Is vsync enabled or disabled?

            Anyway I really do not think QML garbage collection plays any part in this performance.

            1 Reply Last reply Reply Quote 0
            • D
              dvolosnykh last edited by

              I've checked that on Windows 7 and its rather smooth, too, even that it runs on 10 years old laptop.

              Jerkyness is easily noticeable and reproduces constantly and consistently: extremely jerky at the very start of the application and then it becomes acceptably smooth with periodical (approximately over a constant time period) freezes for a short time.

              Veryfied issue on Ubuntu 12.04 laptop. Sync to VBlank is enabled in NVIDIA X Server Settings.

              1 Reply Last reply Reply Quote 0
              • D
                dvolosnykh last edited by

                I've updated my video graphics adapter driver to the most recent version, and now animation is rather smooth, except for some flickering.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post