Sur cette page

StateChangeScript QML Type

Spécifie comment exécuter un script dans un état. En savoir plus…

Import Statement: import QtQuick

Propriétés

Description détaillée

Un StateChangeScript est exécuté lors du passage à un nouvel état. Vous pouvez, si vous le souhaitez, utiliser ScriptAction pour spécifier le moment de la transition auquel le StateChangeScript doit être exécuté.

State {
    name: "state1"
    StateChangeScript {
        name: "myScript"
        script: doStateStuff();
    }
    // ...
}
// ...
Transition {
    to: "state1"
    SequentialAnimation {
        NumberAnimation { /* ... */ }
        ScriptAction { scriptName: "myScript" }
        NumberAnimation { /* ... */ }
    }
}

Voir également ScriptAction.

Documentation sur les propriétés

name : string

Cette propriété contient le nom du script. Ce nom peut être utilisé par une ScriptAction pour cibler un script spécifique.

Voir également « ScriptAction::scriptName ».

script : script

Cette propriété contient le script à exécuter lorsque l'état est « current ».

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.