QAbstractState Class

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

头文件: #include <QAbstractState>
qmake: QT += core
开始支持版本: Qt 4.6
基类: QObject
派生类:

QFinalState, QHistoryState, and QState

属性

公有函数

~QAbstractState()
bool active() const
QStateMachine *machine() const
QState *parentState() const
  • 32 个公有函数继承自 QObject

信号

void activeChanged(bool active)
void entered()
void exited()

受保护的函数

QAbstractState(QState *parent = Q_NULLPTR)
virtual void onEntry(QEvent *event) = 0
virtual void onExit(QEvent *event) = 0

重新实现的受保护函数

virtual bool event(QEvent *e)
  • 9 个受保护的函数继承自 QObject

其他继承的成员

  • 1 个公有槽函数继承自 QObject
  • 11 个静态公有成员继承自 QObject

详细描述

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

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.

属性

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.

访问函数:

bool active() const

Notifier signal:

void activeChanged(bool active)

成员函数

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

Constructs a new state with the given parent state.

QAbstractState::~QAbstractState()

Destroys this state.

bool QAbstractState::active() const

Returns whether this state is active.

Note: Getter function for property active.

参见 activeChanged(bool), entered(), and exited().

[signal] void QAbstractState::activeChanged(bool active)

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

This function was introduced in Qt 5.4.

Note: Notifier signal for property active.

参见 QAbstractState::active, entered(), and exited().

[signal] void QAbstractState::entered()

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

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

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

Reimplemented from QObject::event().

[signal] void QAbstractState::exited()

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

Note: 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 0 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 0 if the state has no parent state.