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

Regression: Behavior-driven Animations applied to alias properties have no effect

XMLWordPrintable

      With Qt 5.5, pressing the yellow Rectangle in the example below would animate the value, but with 5.6, it goes immediately to the target value.

      main.qml:

      import QtQuick 2.3
      import QtQuick.Controls 1.4
      import QtQuick.Controls.Styles 1.4
      import QtQuick.Controls.Private 1.0
      
      Item {
          width: 400
          height: 400
          property bool accelerating : false
          
          Text {
              anchors.centerIn: parent
              text: "Press anywere to accelerate"
          }
      
          Accelerator {
              id: acc
              anchors.fill: parent
              value: accelerating ? 400 : 0                           // COMMENT OUT THIS 
              Behavior on value {
                  NumberAnimation {
                      easing.type: Easing.OutCubic
                      duration: 3000
                  }
              }
          }
      
          MouseArea {
              anchors.fill: parent
              onPressedChanged: accelerating = pressed                // ...AND COMMENT OUT THIS
              //onPressedChanged: { acc.value = (pressed ? 400 : 0) } // ...AND UNCOMMENT OUT THIS AND IT WORKS
          }
      }
      

      Accelerator.qml:

      import QtQuick 2.3
      
      Rectangle {
          property alias value: range.width
          color: "yellow"
          Text {
              text: 'value: ' + value
          }
      
          Rectangle {
              id: range
              color: "red"
              width: 0
              height: 5
              anchors.bottom: parent.bottom
          }
      }
      

        For Gerrit Dashboard: QTBUG-49072
        # Subject Branch Project Status CR V

            laknoll Lars Knoll
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes