State QML 类型

Provides a general-purpose state for StateMachine . 更多...

导入语句: import QtQml.StateMachine 1.0
Since: Qt 5.4
继承:

QAbstractState

继承者:

StateMachine

特性

信号

详细描述

State objects can have child states as well as transitions to other states. State is part of 声明状态机框架 .

States with Child States

childMode property determines how child states are treated. For non-parallel state groups, the initialState property must be used to set the initial state. The child states are mutually exclusive states, and the state machine needs to know which child state to enter when the parent state is the target of a transition.

The state emits the State::finished() signal when a final child state ( FinalState ) is entered.

errorState sets the state's error state. The error state is the state that the state machine will transition to if an error is detected when attempting to enter the state (e.g. because no initial state has been set).

用法范例

import QtQuick 2.0
import QtQml.StateMachine 1.0 as DSM
Rectangle {
    DSM.StateMachine {
        id: stateMachine
        initialState: state
        running: true
        DSM.State {
            id: state
        }
    }
}
					

另请参阅 StateMachine and FinalState .

特性文档编制

childMode : enumeration

The child mode of this state

此特性的默认值为 QState .ExclusiveStates.

This enum specifies how a state's child states are treated:


errorState : QAbstractState

The error state of this state.


initialState : QAbstractState

The initial state of this state (one of its child states).


信号文档编制

finished ()

This signal is emitted when a final child state of this state is entered.

相应处理程序是 onFinished .

另请参阅 QAbstractState::active , QAbstractState::entered ,和 QAbstractState::exited .