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

PropertyAnimation ignores from/to changes

    XMLWordPrintable

Details

    • 44dd79eeda (qt/qtdeclarative/dev) 44dd79eeda (qt/tqtc-qtdeclarative/dev)

    Description

      Run the following test case and resize the window => the animation is "off". Toggling Animation::running helps to re-evaluate from & to -values, but this makes it very inconvenient to implement for example busy animation for scalable progress bars etc. where the from & to -values are not fixed. It would be better if PropertyAnimation would mark the changed from & to -values as dirty, and update the animation in the beginning of the next loop.

      import QtQuick 2.2
      
      MouseArea {
          id: window
      
          width: 300
          height: 200
      
          Rectangle {
              id: background
              radius: 2
              clip: true
              color: "lightgray"
              width: parent.width / 3 * 2
              height: parent.height / 10
              anchors.centerIn: parent
      
              Rectangle {
                  id: bar
                  color: "lightsteelblue"
                  border.color: "steelblue"
                  width: parent.width / 2
                  height: parent.height / 2
                  anchors.verticalCenter: parent.verticalCenter
      
                  NumberAnimation on x {
                      id: anim
                      from: -bar.width
                      to: frame.width
                      loops: Animation.Infinite
                      duration: 1000
                  }
              }
      
              Rectangle {
                  id: frame
                  radius: 2
                  color: "transparent"
                  border.color: "gray"
                  border.width: 1
                  anchors.fill: parent
              }
          }
      
          onClicked: {
              anim.stop()
              anim.start()
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              jpnurmi J-P Nurmi
              Votes:
              5 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes