Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-42946

[REG 5.3 -> 5.4]: Animations and timers run too fast

    XMLWordPrintable

Details

    Description

      By following code I tried to reproduce actual problem with timers and animations.
      With Qt 5.3.2 I mostly see 1001 in console, but with Qt 5.4 - 985.
      In our application only in release mode the animations and timers run too fast.

      import QtQuick 2.0
      
      Item {
          id: root
      
          Timer {
              running: true
              triggeredOnStart: true
              repeat: true
              interval: 1000
              property real lastDate: Date.now();
              onTriggered: {
                  const now = Date.now();
                  console.log("> " + (now - lastDate))
                  lastDate = now;
              }
          }
      
          Flipable {
              id: flipable
              width: root.width
              height: root.height
      
              property bool flipped: false
              property bool horizontalFlip: false
      
              transform: Rotation {
                  id: flipRotation
                  origin.x: flipable.width/2
                  origin.y: flipable.height/2
                  axis.x: flipable.horizontalFlip ? 0 : 1
                  axis.y: flipable.horizontalFlip ? 1 : 0
                  axis.z: 0
                  angle: 0
              }
      
              states: State {
                  when: flipable.flipped
                  PropertyChanges {
                      target: flipRotation
                      angle: 180
                  }
                  AnchorChanges {
                      target: flipable
                      anchors.horizontalCenter: root.horizontalCenter
                      anchors.top: root.top
                  }
              }
      
              transitions: Transition {
                  ParallelAnimation {
                      AnchorAnimation {
                          duration: animTimer.interval
                      }
                      NumberAnimation {
                          target: flipRotation
                          property: "angle"
                          duration: animTimer.interval
                      }
                  }
              }
      
              front: Rectangle {
                  anchors.fill: parent
                  color: "yellow"
                  Text {
                      anchors.centerIn: parent
                      fontSizeMode: Text.Fit
                      font.pointSize: 64
                      text: "Front"
                  }
              }
      
              back: Rectangle {
                  anchors.fill: parent
                  color: "green"
                  Text {
                      anchors.centerIn: parent
                      fontSizeMode: Text.Fit
                      font.pointSize: 64
                      text: "Back"
                  }
              }
      
              Timer {
                  id: animTimer
                  running: true
                  repeat: true
                  interval: 1000
                  onTriggered: {
                      flipable.flipped = !flipable.flipped;
                  }
              }
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sletta Gunnar Sletta
            nodir.temir Nodir Temirkhodjaev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes