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

Unexpected Animation "running" property behavior

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 4.7.3, 5.0.0
    • None

      Run the code below.
      Note that "running: true" is printed in the debug console upon start. This is unexpected as property change notifications are usually only triggered when the value changes from its initial value.

      Now replace the SequentialAnimation's "running: true" code with any other expression that evaluates to true, such as "running: blueRect.width > 0" and note that the animation does not run.

      import QtQuick 1.1
      Item {
          width: 950
          height: 500
      
          Rectangle {
              id: blueRect
              color: "blue"
              width: 500; height: 300
      
              Rectangle {
                  id: redRect
                  color: "red"
                  width: 50
                  height: 50
                  anchors.verticalCenter: parent.verticalCenter
              }
      
              SequentialAnimation {
                  id: anim
                  running: true                  // works
      //          running: blueRect.width > 0    // doesn't work!
                  onRunningChanged: print("running: " + running)
                  loops: Animation.Infinite
                  NumberAnimation {
                      target: redRect; property: "x"
                      from: 0; to: blueRect.width-redRect.width
                      duration: 1000
                  }
                  NumberAnimation {
                      target: redRect; property: "x"
                      from: blueRect.width-redRect.width; to: 0
                      duration: 1000
                  }
              }
          }
      }
      

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mathiasm Mathias Malmqvist
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes