QFinalState Class Reference
[QtCore module]
该QFinalState类提供了一个最终状态。More…
Methods
__init__ (self, QState parent = None)
bool event (self, QEvent e)
onEntry (self, QEvent event)
onExit (self, QEvent event)
Detailed Description
该QFinalState类提供了一个最终状态。
最终状态是用来沟通的(部分)一QStateMachine已完成其工作。当进入最后的顶级状态,状态机的finished()信号被发射。的一个在一般情况下,当最后的子状态(子QState)输入,父状态的finished()信号被发射。 QFinalState是一部分The State Machine Framework。
要使用一个最终状态,您可以创建一个QFinalState对象,并添加从另一个状态过渡到它。例如:
[QPushButton](qpushbutton.html) button;
[QStateMachine]($docs-qstatemachine.html) machine;
[QState]($docs-qstate.html) *s1 = new [QState]($docs-qstate.html)();
QFinalState *s2 = new QFinalState();
s1->addTransition(&button, SIGNAL(clicked()), s2);
machine.addState(s1);
machine.addState(s2);
[QObject](qobject.html).connect(&machine, SIGNAL(finished()), [QApplication](qapplication.html).instance(), SLOT(quit()));
machine.setInitialState(s1);
machine.start();
Method Documentation
QFinalState.__init__ (self, QState parent = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个新的QFinalState与给定对象parent状态。
bool QFinalState.event (self, QEvent e)
从重新实现QObject.event( ) 。
QFinalState.onEntry (self, QEvent event)
从重新实现QAbstractState.onEntry( ) 。
QFinalState.onExit (self, QEvent event)
从重新实现QAbstractState.onExit( ) 。