The QFinalState class provides a final state. 更多...
头: | #include <QFinalState> |
qmake: | QT += core |
Since: | Qt 4.6 |
继承: | QAbstractState |
QFinalState (QState * parent = Q_NULLPTR) | |
~QFinalState () |
virtual bool | event (QEvent * e ) |
virtual void | onEntry (QEvent * event ) |
virtual void | onExit (QEvent * event ) |
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 对象采用给定 parent 状态。
销毁此最终状态。
[virtual protected]
bool
QFinalState::
event
(
QEvent
*
e
)
重实现自 QObject::event ().
[virtual protected]
void
QFinalState::
onEntry
(
QEvent
*
event
)
重实现自 QAbstractState::onEntry ().
[virtual protected]
void
QFinalState::
onExit
(
QEvent
*
event
)
重实现自 QAbstractState::onExit ().