QAbstractState Class

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

Header: #include <QAbstractState>
qmake: QT += core
Since: Qt 4.6
Inherits: QObject
Inherited By:

QFinalState, QHistoryState, and QState

This class was introduced in Qt 4.6.

Properties

  • 1 property inherited from QObject

Public Functions

virtual ~QAbstractState()
bool active() const
QStateMachine *machine() const
QState *parentState() const
  • 16 public functions inherited from QObject

Signals

void activeChanged(bool active)

Protected Functions

QAbstractState(QState *parent = nullptr)

Reimplemented Protected Functions

virtual bool event(QEvent *e) override
  • 8 protected functions inherited from QObject
typedef QObjectList

Macros

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 5 static public members inherited from QObject

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

active : const bool

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.

Access functions:

bool active() const

Notifier signal:

void activeChanged(bool active)

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.

Note: Getter function for property active.

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

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

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

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.

QState *QAbstractState::parentState() const

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