QAbstractState 类

QAbstractState 类是状态基类对于 QStateMachine . 更多...

头: #include <QAbstractState>
qmake: QT += core
Since: Qt 4.6
继承: QObject
继承者:

QFinalState , QHistoryState ,和 QState

该类在 Qt 4.6 引入。

特性

公共函数

virtual ~QAbstractState ()
bool active () const
QStateMachine * machine () const
QState * parentState () const

信号

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

保护函数

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

重实现保护函数

virtual bool event (QEvent * e ) override

详细描述

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

子类化

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 () 和 exited () 信号。

该特性在 Qt 5.4 引入。

访问函数:

bool active () const

通知程序信号:

void activeChanged (bool active )

成员函数文档编制

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

构造新的状态采用给定 parent 状态。

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

This signal is emitted when the active property is changed with active 作为自变量。

注意: 通知程序信号对于特性 active .

该函数在 Qt 5.4 引入。

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

[signal] void QAbstractState:: entered ()

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

注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。

[signal] void QAbstractState:: exited ()

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

注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。

[虚拟] QAbstractState:: ~QAbstractState ()

销毁此状态。

bool QAbstractState:: active () const

Returns whether this state is active.

注意: Getter function for property active.

另请参阅 activeChanged (bool), entered (),和 exited ().

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

重实现: 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.

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