FinalState QML 类型

提供最终状态。 更多...

import 语句: import QtQml.StateMachine 1.12
Since: Qt 5.4
继承: QAbstractState

详细描述

最终状态用于传达 (属于) StateMachine 已完成其工作。当进入最终顶层状态时,状态机的 finished () signal is emitted. In general, when a final substate (a child of a State) is entered, the parent state's finished () 信号发射。 FinalState 属于 声明状态机框架 .

To use a final state, you create a FinalState object and add a transition to it from another state.

用法范例

import QtQuick 2.0
import QtQml.StateMachine 1.0 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 and State .