IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QAbstractState Class

The QAbstractState class is the base class of states of a QStateMachine.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QAbstractState Class

  • Header: QAbstractState

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS StateMachine)

    target_link_libraries(mytarget PRIVATE Qt6::StateMachine)

  • qmake: QT += statemachine

  • Inherits: QObject

  • Inherited By: QFinalState, QHistoryState, and QState

  • Group: QAbstractState is part of statemachine

Detailed Description

The QAbstractState class is the abstract base class of states that are part of a QStateMachine. It defines the interface that all state objects have in common. QAbstractState is part of Qt State Machine Framework.

The entered() signal is emitted when the state has been entered. The exited() signal is emitted when the state has been exited.

The parentState() function returns the state's parent state. The machine() function returns the state machine that the state is part of.

Subclassing

The onEntry() function is called when the state is entered; reimplement this function to perform custom processing when the state is entered.

The onExit() function is called when the state is exited; reimplement this function to perform custom processing when the state is exited.

Property Documentation

 

[bindable read-only, since 5.4] active : bool

This property supports QProperty bindings.

This property holds the active property of this state. A state is active between entered() and exited() signals.

This property was introduced in Qt 5.4.

Member Function Documentation

 

[protected] QAbstractState::QAbstractState(QState *parent = nullptr)

Constructs a new state with the given parent state.

[virtual] QAbstractState::~QAbstractState()

Destroys this state.

bool QAbstractState::active() const

Returns whether this state is active.

Getter function for property active.

See Also

See also activeChanged(bool), entered(), exited()

[since 5.4] void QAbstractState::activeChanged(bool active)

This signal is emitted when the active property is changed with active as argument.

Notifier signal for property active.

This function was introduced in Qt 5.4.

See Also

void QAbstractState::entered()

This signal is emitted when the state has been entered (after onEntry() has been called).

This is a private signal. It can be used in signal connections but cannot be emitted by the user.

[override virtual protected] bool QAbstractState::event(QEvent *e)

Reimplements: QObject::event(QEvent *e).

void QAbstractState::exited()

This signal is emitted when the state has been exited (after onExit() has been called).

This is a private signal. It can be used in signal connections but cannot be emitted by the user.

QStateMachine *QAbstractState::machine() const

Returns the state machine that this state is part of, or nullptr if the state is not part of a state machine.

[pure virtual protected] void QAbstractState::onEntry(QEvent *event)

This function is called when the state is entered. The given event is what caused the state to be entered. Reimplement this function to perform custom processing when the state is entered.

[pure virtual protected] void QAbstractState::onExit(QEvent *event)

This function is called when the state is exited. The given event is what caused the state to be exited. Reimplement this function to perform custom processing when the state is exited.

QState *QAbstractState::parentState() const

Returns this state's parent state, or nullptr if the state has no parent state.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+