QFinalState 类

The QFinalState class provides a final state. 更多...

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

公共函数

QFinalState (QState * parent = nullptr)
virtual ~QFinalState ()

静态公共成员

const QMetaObject staticMetaObject

重实现保护函数

virtual bool event (QEvent * e ) override
virtual void onEntry (QEvent * event ) override
virtual void onExit (QEvent * event ) override

额外继承成员

详细描述

The QFinalState class provides a final state.

最终状态用于传达 (属于) QStateMachine 已完成其工作。当进入最终顶层状态时,状态机的 finished () 信号发射。一般而言,当最终子状态 (子级化的 QState ) 进入,父级状态的 finished () 信号发射。 QFinalState 属于 状态机框架 .

To use a final state, you create a QFinalState object and add a transition to it from another state. Example:

QPushButton button;
QStateMachine machine;
QState *s1 = new QState();
QFinalState *s2 = new QFinalState();
s1->addTransition(&button, SIGNAL(clicked()), s2);
machine.addState(s1);
machine.addState(s2);
QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
machine.setInitialState(s1);
machine.start();
					

另请参阅 QState::finished ().

成员函数文档编制

QFinalState:: QFinalState ( QState * parent = nullptr)

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

[虚拟] QFinalState:: ~QFinalState ()

销毁此最终状态。

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

重实现自 QAbstractState::event ().

[override virtual protected] void QFinalState:: onEntry ( QEvent * event )

重实现自 QAbstractState::onEntry ().

[override virtual protected] void QFinalState:: onExit ( QEvent * event )

重实现自 QAbstractState::onExit ().