FinalState QML 类型

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

import 语句: import QtQml.StateMachine 6.5
继承: QAbstractState

详细描述

最终状态用于传达 (属于) StateMachine 已完成其工作。当进入最终顶层状态时,状态机的 finished () signal is emitted. In general, when a final substate (a child of a State) is entered, the parent state's finished () signal is emitted. FinalState is part of Qt State Machine QML API

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

用法范例

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 and State .