Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

"Transition completed" notification



  • Greeting Qt Quickers,

    I'm using the following code to get notified when a transition is completed:
    @property bool pTransition: false

    transitions: Transition
    {
    SequentialAnimation
    {
    AnchorAnimation { duration: 100 }

        PropertyAnimation {
            target: item; property: "pTransition"
    
            duration: 0; to: !(pTransition)
       }
    }
    

    }

    onPTransitionChanged: console.debug("Transition completed !")@
    There must be a simpler way... is there ?

    Thanks.

    B.A.



  • Could be something like this:

    @
    signal stopped();

    transitions: Transition
    {
    SequentialAnimation
    {
    AnchorAnimation { duration: 100 }
    onRunningChanged: if(!running) stopped();
    }
    }

    onStopped: console.debug("Transition completed !")
    @



  • running does not seem to change between transitions.

    Could be a bug ?



  • It seems that I still need to use this transition hack with Qt 4.8.1. It's not very "cute".

    Am I missing something ?

    Thanks.



  • You could also use a "ScriptAction":http://qt-project.org/doc/qt-4.8/qml-scriptaction.html as the last action in a SequentialAnimation and call a signal/function to signal that the transition is done



  • Thanks Mario,

    ScriptAction is much more elegant than what I was doing.

    B.A.


Log in to reply