Animation.onFinished not firing
-
I've got a project in which I am fooling around with various animations and transitions for the fun of it. However, I am not happy to find that
Animation.onFinishedis not firing as I would think it should. My code is in two files:main.qml:import QtQuick 2.12 import QtQuick.Window 2.12 Window { id: windowRoot visible: true width: 640 height: 480 title: qsTr("Hello World") function showMainPage() { loader.sourceComponent = mainPage } Loader { id: loader anchors.fill: parent sourceComponent: loadingPage } Component { id: mainPage Rectangle { color: "lightsteelblue" } } Component { id: loadingPage Rectangle { anchors.fill: parent LoadingPage { anchors.centerIn: parent } } } }...and
LoadingPage.qml:import QtQuick 2.12 import QtQuick.Controls 2.12 ProgressBar { id: pb states: State { name: "go" PropertyChanges { target: pb value: pb.to } } transitions: [ Transition { reversible: true SequentialAnimation { PauseAnimation { duration: 500 } NumberAnimation { target: pb properties: "value" duration: 1000 easing.type: Easing.InOutQuad alwaysRunToEnd: true } PauseAnimation { duration: 500 onFinished: windowRoot.showMainPage() } } } ] Label { text: qsTr("Loading...") anchors.bottom: pb.top anchors.horizontalCenter: pb.horizontalCenter anchors.margins: 5 } Component.onCompleted: pb.state = "go" }For some reason, the second
PauseAnimationdoes not actually fire theonFinishedsignal. I've also tried withonFinishedas part of theNumberAnimation, with the same results.I'm using Qt 5.12.8 from the Ubuntu 20.04 repos, and I've also tried 5.15.1 and 6.0.0 without any success.
-
https://doc.qt.io/qt-6/qml-qtquick-animation.html#finished-signal says:
In addition, it is only emitted for top-level, standalone animations. It will not be emitted for animations in a Behavior or Transition, or animations that are part of an animation group.
-
https://doc.qt.io/qt-6/qml-qtquick-animation.html#finished-signal says:
In addition, it is only emitted for top-level, standalone animations. It will not be emitted for animations in a Behavior or Transition, or animations that are part of an animation group.