<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QFinalState Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QFinalState Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QFinalState class provides a final state. <a href="#details">More...</a></p>

<p>Inherits <a href="qabstractstate.html">QAbstractState</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qfinalstate.html#QFinalState">__init__</a></b> (<i>self</i>, QState&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" />bool <b><a href="qfinalstate.html#event">event</a></b> (<i>self</i>, QEvent&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qfinalstate.html#onEntry">onEntry</a></b> (<i>self</i>, QEvent&#160;<i>event</i>)</li><li><div class="fn" /><b><a href="qfinalstate.html#onExit">onExit</a></b> (<i>self</i>, QEvent&#160;<i>event</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QFinalState class provides a final state.</p>
<p>A final state is used to communicate that (part of) a <a href="qstatemachine.html">QStateMachine</a> has finished its work. When
a final top-level state is entered, the state machine's <a href="qstate.html#finished">finished</a>() signal is emitted. In
general, when a final substate (a child of a <a href="qstate.html">QState</a>) is entered, the parent state's <a href="qstate.html#finished">finished</a>() signal is emitted.
QFinalState is part of <a href="statemachine-api.html">The State
Machine Framework</a>.</p>
<p>To use a final state, you create a QFinalState object and add a
transition to it from another state. Example:</p>
<pre class="cpp">
 <span class="type"><a href="qpushbutton.html">QPushButton</a></span> button;

 <span class="type"><a href="qstatemachine.html">QStateMachine</a></span> machine;
 <span class="type"><a href="qstate.html">QState</a></span> <span class="operator">*</span>s1 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstate.html">QState</a></span>();
 <span class="type">QFinalState</span> <span class="operator">*</span>s2 <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QFinalState</span>();
 s1<span class="operator">-</span><span class="operator">&gt;</span>addTransition(<span class="operator">&amp;</span>button<span class="operator">,</span> SIGNAL(clicked())<span class="operator">,</span> s2);
 machine<span class="operator">.</span>addState(s1);
 machine<span class="operator">.</span>addState(s2);

 <span class="type"><a href="qobject.html">QObject</a></span><span class="operator">.</span><a href="qobject.html#connect">connect</a>(<span class="operator">&amp;</span>machine<span class="operator">,</span> SIGNAL(finished())<span class="operator">,</span> <span class="type"><a href="qapplication.html">QApplication</a></span><span class="operator">.</span>instance()<span class="operator">,</span> SLOT(quit()));
 machine<span class="operator">.</span>setInitialState(s1);
 machine<span class="operator">.</span>start();
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QFinalState" />QFinalState.__init__ (<i>self</i>, <a href="qstate.html">QState</a>&#160;<i>parent</i>&#160;=&#160;None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new <a href="qfinalstate.html">QFinalState</a>
object with the given <i>parent</i> state.</p>


<h3 class="fn"><a name="event" />bool QFinalState.event (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p>


<h3 class="fn"><a name="onEntry" />QFinalState.onEntry (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qabstractstate.html#onEntry">QAbstractState.onEntry</a>().</p>


<h3 class="fn"><a name="onExit" />QFinalState.onExit (<i>self</i>, <a href="qevent.html">QEvent</a>&#160;<i>event</i>)</h3><p>Reimplemented from <a href="qabstractstate.html#onExit">QAbstractState.onExit</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.11.2 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://qt.digia.com">Digia</a> 2014</td><td align="right" width="25%">Qt&#160;4.8.6</td></tr></table></div></address></body></html>