Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.3.0
-
af5f853413 (qt/qtdeclarative/dev) 422c6a23ad (qt/qtdeclarative/6.4) 422c6a23ad (qt/tqtc-qtdeclarative/6.4) af5f853413 (qt/tqtc-qtdeclarative/dev) 0f1b671738 (qt/qtdeclarative/6.3) 0f1b671738 (qt/tqtc-qtdeclarative/6.3), 84c2b72c4 (tqtc/lts-6.2)
Description
Given:
- A component with two States
- Where in state 1 a property is bound to the result of an expression
- And in state 2 that same property is re-bound to a constant
- And a PropertyAnimation is applied on that property when transitioning from state 1 to state 2.
When: I transition from state 1 to state 2
Expected result: The property animates to the target constant value for state 2 and is no longer bound to the expression in state 1
Actual result: The property animates to the target constant value for state 2, BUT it is still bound to the result of the expression in state 1. If the result of the expression changes then the property will update to the new value instead of remaining constant.
Example:
ColumnLayout { id: testItem property bool checked: false property int state1Width: 500 states: [ State { when: !testItem.checked PropertyChanges { testItem.width: testItem.state1Width } }, State { when: testItem.checked PropertyChanges { testItem.width: 300 } } ] transitions: Transition { id: transition SmoothedAnimation { target: testItem; property: "width"; velocity: 1000 } } Button { ColumnLayout.fillWidth: true text: "Change state (Currently " + (!testItem.checked ? "State 1)" : "State 2)") onClicked: function() { testItem.checked = !testItem.checked; } } Button { text: "Update state 1 width" ColumnLayout.fillWidth: true onClicked: function() { testItem.state1Width += 1; } } }