State

Provides a general-purpose state for StateMachine. More...

Import Statement: import QtQml.StateMachine 1.11
Since: Qt 5.4
Inherits:

QAbstractState

Inherited By:

StateMachine

Properties

Signals

Detailed Description

State objects can have child states as well as transitions to other states. State is part of The Declarative State Machine Framework.

States with Child States

The 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.

The 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).

Example Usage

import QtQuick 2.0
import QtQml.StateMachine 1.0 as DSM

Rectangle {
    DSM.StateMachine {
        id: stateMachine
        initialState: state
        running: true
        DSM.State {
            id: state
        }
    }
}

See also StateMachine and FinalState.

Property Documentation

childMode : enumeration

The child mode of this state

The default value of this property is QState.ExclusiveStates.

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

  • QState.ExclusiveStates The child states are mutually exclusive and an initial state must be set by setting initialState property.
  • QState.ParallelStates The child states are parallel. When the parent state is entered, all its child states are entered in parallel.

errorState : QAbstractState

The error state of this state.


initialState : QAbstractState

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


Signal Documentation

finished()

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

The corresponding handler is onFinished.

See also QAbstractState::active, QAbstractState::entered, and QAbstractState::exited.


Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support