QFinalState 类提供最终状态。 更多...
头: | #include <QFinalState> |
qmake: | QT += core |
Since: | Qt 4.6 |
继承: | QAbstractState |
该类在 Qt 4.6 引入。
QFinalState (QState * parent = nullptr) | |
virtual | ~QFinalState () |
virtual bool | event (QEvent * e ) override |
virtual void | onEntry (QEvent * event ) override |
virtual void | onExit (QEvent * event ) override |
最终状态用于传达 (属于) QStateMachine 已完成其工作。当进入最终顶层状态时,状态机的 finished () 信号发射。一般而言,当最终子状态 (子级化的 QState ) 进入,父级状态的 finished () 信号发射。QFinalState 属于 状态机框架 .
要使用最终状态,创建 QFinalState 对象并从另一状态向其添加过渡。范例:
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 状态。
[虚拟]
QFinalState::
~QFinalState
()
销毁此最终状态。
[override virtual protected]
bool
QFinalState::
event
(
QEvent
*
e
)
重实现: QAbstractState::event (QEvent *e).
[override virtual protected]
void
QFinalState::
onEntry
(
QEvent
*
event
)
重实现: QAbstractState::onEntry (QEvent *event).
[override virtual protected]
void
QFinalState::
onExit
(
QEvent
*
event
)
重实现: QAbstractState::onExit (QEvent *event).