Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
None
-
6.2.2
-
None
Description
Consider the following example. Pressing the button moves the green rectangle from left to right. Now resize the window while the animation is running. The rectangle moves to the old x target value and stays there, which leaves the application in an inconsistent state. Resizing the window again shows that x is correctly bound to "parent.width - rect.width" but it was never updated to the new value.
This bug occurrs in Qt 6.2.2. It works correctly with Qt 5.15, which also runs the animation to the old target value, but then immediately moves the rectangle to the new value after the transition finished.
import QtQuick 2.15 import QtQuick.Controls 2.15 ApplicationWindow { width: 640; height: 240 visible: true Item { anchors.fill: parent state: "left" Rectangle { id: rect width: 100; height: 100 color: "green" } Button { anchors { bottom: parent.bottom horizontalCenter: parent.horizontalCenter } text: "Change state" onClicked: parent.state = "right" } states: [ State { name: "left" PropertyChanges { target: rect; x: 0 } }, State { name: "right" PropertyChanges { target: rect; x: parent.width - rect.width } } ] transitions: [ Transition { NumberAnimation { property: "x"; duration: 3000 } } ] } }