FinalState QML Type
提供最终状态。更多
Import Statement: | import QtQml.StateMachine 6.9 |
Inherits: |
详细说明
最终状态用于告知StateMachine (部分)工作已完成。当进入最终顶层状态时,状态机的finished() 信号就会发出。一般来说,当进入最终子状态(State 的子状态)时,父状态的finished() 信号就会发出。FinalState 是Qt State Machine QML API的一部分
要使用最终状态,需要创建一个 FinalState 对象,并从另一个状态向其添加过渡。
使用示例
import QtQuick import QtQml.StateMachine as DSM Rectangle { DSM.StateMachine { id: stateMachine initialState: state running: true DSM.State { id: state DSM.TimeoutTransition { targetState: finalState timeout: 200 } } DSM.FinalState { id: finalState } onFinished: console.log("state finished") } }
另请参阅 StateMachine 和State 。
© 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.