StateChangeScript QML Type

指定如何在某一状态下运行脚本。更多

Import Statement: import QtQuick

属性

详细说明

StateChangeScript 在进入状态时运行。您可以选择使用ScriptAction 来指定运行 StateChangeScript 的转换点。

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

另请参阅 ScriptAction

属性文档

name : string

此属性包含脚本的名称。ScriptAction 可使用此名称来定位特定脚本。

另请参阅 ScriptAction::scriptName


script : script

此属性保存状态为当前时要运行的脚本。


© 2025 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.