Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 4952

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qstatemachine.cpp -->
<head>
  <title>Qt 4.6: QStateMachine Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QStateMachine"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QStateMachine Class Reference<br /><span class="small-subtitle">[<a href="qtcore.html">QtCore</a> module]</span>
</h1>
<p>The QStateMachine class provides a hierarchical finite state machine. <a href="#details">More...</a></p>
<pre> #include &lt;QStateMachine&gt;</pre><p>Inherits <a href="qstate.html">QState</a>.</p>
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>, but <a href="qstatemachine.html#postEvent">postEvent</a>(), <a href="qstatemachine.html#postDelayedEvent">postDelayedEvent</a>(), and <a href="qstatemachine.html#cancelDelayedEvent">cancelDelayedEvent</a>() are also <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p>This class was introduced in Qt 4.6.</p>
<ul>
<li><a href="qstatemachine-members.html">List of all members, including inherited members</a></li>
</ul>
<hr />
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine-signalevent.html">SignalEvent</a></b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine-wrappedevent.html">WrappedEvent</a></b></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#Error-enum">Error</a></b> { NoError, NoInitialStateError, NoDefaultStateInHistoryStateError, NoCommonAncestorForTransitionError }</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#EventPriority-enum">EventPriority</a></b> { NormalPriority, HighPriority }</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#RestorePolicy-enum">RestorePolicy</a></b> { DontRestoreProperties, RestoreProperties }</td></tr>
</table>
<hr />
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li><div class="fn"><b><a href="qstatemachine.html#animated-prop">animated</a></b> : bool</div></li>
<li><div class="fn"><b><a href="qstatemachine.html#errorString-prop">errorString</a></b> : const QString</div></li>
<li><div class="fn"><b><a href="qstatemachine.html#globalRestorePolicy-prop">globalRestorePolicy</a></b> : RestorePolicy</div></li>
</ul>
<ul>
<li><div bar="2" class="fn"></div>3 properties inherited from <a href="qstate.html#properties">QState</a></li>
<li><div bar="2" class="fn"></div>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#QStateMachine">QStateMachine</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#dtor.QStateMachine">~QStateMachine</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#addDefaultAnimation">addDefaultAnimation</a></b> ( QAbstractAnimation * <i>animation</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#addState">addState</a></b> ( QAbstractState * <i>state</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#cancelDelayedEvent">cancelDelayedEvent</a></b> ( int <i>id</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#clearError">clearError</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QSet&lt;QAbstractState *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#configuration">configuration</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QList&lt;QAbstractAnimation *&gt; </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#defaultAnimations">defaultAnimations</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">Error </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#error">error</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#errorString-prop">errorString</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QStateMachine::RestorePolicy </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#globalRestorePolicy-prop">globalRestorePolicy</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#animated-prop">isAnimated</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#isRunning">isRunning</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#postDelayedEvent">postDelayedEvent</a></b> ( QEvent * <i>event</i>, int <i>delay</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#postEvent">postEvent</a></b> ( QEvent * <i>event</i>, EventPriority <i>priority</i> = NormalPriority )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#removeDefaultAnimation">removeDefaultAnimation</a></b> ( QAbstractAnimation * <i>animation</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#removeState">removeState</a></b> ( QAbstractState * <i>state</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#animated-prop">setAnimated</a></b> ( bool <i>enabled</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#globalRestorePolicy-prop">setGlobalRestorePolicy</a></b> ( QStateMachine::RestorePolicy <i>restorePolicy</i> )</td></tr>
</table>
<hr />
<a name="reimplemented-public-functions"></a>
<h2>Reimplemented Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#eventFilter">eventFilter</a></b> ( QObject * <i>watched</i>, QEvent * <i>event</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>11 public functions inherited from <a href="qstate.html#public-functions">QState</a></li>
<li><div bar="2" class="fn"></div>2 public functions inherited from <a href="qabstractstate.html#public-functions">QAbstractState</a></li>
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<hr />
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#start">start</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#stop">stop</a></b> ()</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<hr />
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#started">started</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#stopped">stopped</a></b> ()</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>2 signals inherited from <a href="qstate.html#signals">QState</a></li>
<li><div bar="2" class="fn"></div>2 signals inherited from <a href="qabstractstate.html#signals">QAbstractState</a></li>
<li><div bar="2" class="fn"></div>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<hr />
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#event">event</a></b> ( QEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#onEntry">onEntry</a></b> ( QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qstatemachine.html#onExit">onExit</a></b> ( QEvent * <i>event</i> )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>3 protected functions inherited from <a href="qstate.html#protected-functions">QState</a></li>
<li><div bar="2" class="fn"></div>3 protected functions inherited from <a href="qabstractstate.html#protected-functions">QAbstractState</a></li>
<li><div bar="2" class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"></div>3 protected functions inherited from <a href="qstate.html#protected-functions">QState</a></li>
<li><div class="fn"></div>3 protected functions inherited from <a href="qabstractstate.html#protected-functions">QAbstractState</a></li>
<li><div class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QStateMachine class provides a hierarchical finite state machine.</p>
<p>QStateMachine is based on the concepts and notation of <a href="http://www.wisdom.weizmann.ac.il/~dharel/SCANNED.PAPERS/Statecharts.pdf">Statecharts</a>. QStateMachine is part of <a href="statemachine-api.html">The State Machine Framework</a>.</p>
<p>A state machine manages a set of states (classes that inherit from <a href="qabstractstate.html">QAbstractState</a>) and transitions (descendants of <a href="qabstracttransition.html">QAbstractTransition</a>) between those states; these states and transitions define a state graph. Once a state graph has been built, the state machine can execute it. QStateMachine's execution algorithm is based on the <a href="http://www.w3.org/TR/scxml/">State Chart XML (SCXML)</a> algorithm. The framework's <a href="statemachine-api.html">overview</a> gives several state graphs and the code to build them.</p>
<p>Use the <a href="qstatemachine.html#addState">addState</a>() function to add a top-level state to the state machine. States are removed with the <a href="qstatemachine.html#removeState">removeState</a>() function. Removing states while the machine is running is discouraged.</p>
<p>Before the machine can be started, the <a href="qstate.html#initialState-prop">initial state</a> must be set. The initial state is the state that the machine enters when started. You can then <a href="qstatemachine.html#start">start</a>() the state machine. The <a href="qstatemachine.html#started">started</a>() signal is emitted when the initial state is entered.</p>
<p>The machine is event driven and keeps its own event loop. Events are posted to the machine through <a href="qstatemachine.html#postEvent">postEvent</a>(). Note that this means that it executes asynchronously, and that it will not progress without a running event loop. You will normally not have to post events to the machine directly as Qt's transitions, e.g&#x2e;, <a href="qeventtransition.html">QEventTransition</a> and its subclasses, handle this. But for custom transitions triggered by events, <a href="qstatemachine.html#postEvent">postEvent</a>() is useful.</p>
<p>The state machine processes events and takes transitions until a top-level final state is entered; the state machine then emits the <a href="qstate.html#finished">finished</a>() signal. You can also <a href="qstatemachine.html#stop">stop</a>() the state machine explicitly. The <a href="qstatemachine.html#stopped">stopped</a>() signal is emitted in this case.</p>
<p>The following snippet shows a state machine that will finish when a button is clicked:</p>
<pre> QPushButton button;

 QStateMachine machine;
 QState *s1 = new QState();
 s1-&gt;assignProperty(&amp;button, &quot;text&quot;, &quot;Click me&quot;);

 QFinalState *s2 = new QFinalState();
 s1-&gt;addTransition(&amp;button, SIGNAL(clicked()), s2);

 machine.addState(s1);
 machine.addState(s2);
 machine.setInitialState(s1);
 machine.start();</pre>
<p>This code example uses <a href="qstate.html">QState</a>, which inherits <a href="qabstractstate.html">QAbstractState</a>. The <a href="qstate.html">QState</a> class provides a state that you can use to set properties and invoke methods on <a href="qobject.html">QObject</a>s when the state is entered or exited. It also contains convenience functions for adding transitions, e.g&#x2e;, <a href="qsignaltransition.html">QSignalTransition</a>s as in this example. See the <a href="qstate.html">QState</a> class description for further details.</p>
<p>If an error is encountered, the machine will look for an <a href="qstate.html#errorState-prop">error state</a>, and if one is available, it will enter this state. The types of errors possible are described by the <a href="qstatemachine.html#Error-enum">Error</a> enum. After the error state is entered, the type of the error can be retrieved with <a href="qstatemachine.html#error">error</a>(). The execution of the state graph will not stop when the error state is entered. If no error state applies to the erroneous state, the machine will stop executing and an error message will be printed to the console.</p>
<p>See also <a href="qabstractstate.html">QAbstractState</a>, <a href="qabstracttransition.html">QAbstractTransition</a>, <a href="qstate.html">QState</a>, and <a href="statemachine-api.html">The State Machine Framework</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<a name="//apple_ref/cpp/tag/QStateMachine/Error"></a>
<a name="//apple_ref/cpp/econst/QStateMachine/NoError"></a>
<a name="//apple_ref/cpp/econst/QStateMachine/NoInitialStateError"></a>
<a name="//apple_ref/cpp/econst/QStateMachine/NoDefaultStateInHistoryStateError"></a>
<a name="//apple_ref/cpp/econst/QStateMachine/NoCommonAncestorForTransitionError"></a>
<h3 class="fn"><a name="Error-enum"></a>enum QStateMachine::Error</h3>
<p>This enum type defines errors that can occur in the state machine at run time. When the state machine encounters an unrecoverable error at run time, it will set the error code returned by <a href="qstatemachine.html#error">error</a>(), the error message returned by <a href="qstatemachine.html#errorString-prop">errorString</a>(), and enter an error state based on the context of the error.</p>
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QStateMachine::NoError</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">No error has occurred.</td></tr>
<tr><td valign="top"><tt>QStateMachine::NoInitialStateError</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The machine has entered a <a href="qstate.html">QState</a> with children which does not have an initial state set. The context of this error is the state which is missing an initial state.</td></tr>
<tr><td valign="top"><tt>QStateMachine::NoDefaultStateInHistoryStateError</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The machine has entered a <a href="qhistorystate.html">QHistoryState</a> which does not have a default state set. The context of this error is the <a href="qhistorystate.html">QHistoryState</a> which is missing a default state.</td></tr>
<tr><td valign="top"><tt>QStateMachine::NoCommonAncestorForTransitionError</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The machine has selected a transition whose source and targets are not part of the same tree of states, and thus are not part of the same state machine. Commonly, this could mean that one of the states has not been given any parent or added to any machine. The context of this error is the source state of the transition.</td></tr>
</table></p>
<p>See also <a href="qstate.html#errorState-prop">setErrorState</a>().</p>
<a name="//apple_ref/cpp/tag/QStateMachine/EventPriority"></a>
<a name="//apple_ref/cpp/econst/QStateMachine/NormalPriority"></a>
<a name="//apple_ref/cpp/econst/QStateMachine/HighPriority"></a>
<h3 class="fn"><a name="EventPriority-enum"></a>enum QStateMachine::EventPriority</h3>
<p>This enum type specifies the priority of an event posted to the state machine using <a href="qstatemachine.html#postEvent">postEvent</a>().</p>
<p>Events of high priority are processed before events of normal priority.</p>
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QStateMachine::NormalPriority</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The event has normal priority.</td></tr>
<tr><td valign="top"><tt>QStateMachine::HighPriority</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The event has high priority.</td></tr>
</table></p>
<a name="//apple_ref/cpp/tag/QStateMachine/RestorePolicy"></a>
<a name="//apple_ref/cpp/econst/QStateMachine/DontRestoreProperties"></a>
<a name="//apple_ref/cpp/econst/QStateMachine/RestoreProperties"></a>
<h3 class="fn"><a name="RestorePolicy-enum"></a>enum QStateMachine::RestorePolicy</h3>
<p>This enum specifies the restore policy type. The restore policy takes effect when the machine enters a state which sets one or more properties. If the restore policy is set to RestoreProperties, the state machine will save the original value of the property before the new value is set.</p>
<p>Later, when the machine either enters a state which does not set a value for the given property, the property will automatically be restored to its initial value.</p>
<p>Only one initial value will be saved for any given property. If a value for a property has already been saved by the state machine, it will not be overwritten until the property has been successfully restored.</p>
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QStateMachine::DontRestoreProperties</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The state machine should not save the initial values of properties and restore them later.</td></tr>
<tr><td valign="top"><tt>QStateMachine::RestoreProperties</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The state machine should save the initial values of properties and restore them later.</td></tr>
</table></p>
<p>See also <a href="qstatemachine.html#globalRestorePolicy-prop">QStateMachine::globalRestorePolicy</a> and <a href="qstate.html#assignProperty">QState::assignProperty</a>().</p>
<hr />
<h2>Property Documentation</h2>
<a name="//apple_ref/cpp/instm/QStateMachine/isAnimated"></a>
<a name="//apple_ref/cpp/instm/QStateMachine/setAnimated"></a>
<h3 class="fn"><a name="animated-prop"></a>animated : bool</h3>
<p>This property holds whether animations are enabled.</p>
<p>The default value of this property is true.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b>isAnimated</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setAnimated</b> ( bool <i>enabled</i> )</td></tr>
</table>
<p>See also <a href="qabstracttransition.html#addAnimation">QAbstractTransition::addAnimation</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/errorString"></a>
<h3 class="fn"><a name="errorString-prop"></a>errorString : const <a href="qstring.html">QString</a></h3>
<p>This property holds the error string of this state machine.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b>errorString</b> () const</td></tr>
</table>
<a name="//apple_ref/cpp/instm/QStateMachine/globalRestorePolicy"></a>
<a name="//apple_ref/cpp/instm/QStateMachine/setGlobalRestorePolicy"></a>
<h3 class="fn"><a name="globalRestorePolicy-prop"></a>globalRestorePolicy : <a href="qstatemachine.html#RestorePolicy-enum">RestorePolicy</a></h3>
<p>This property holds the restore policy for states of this state machine.</p>
<p>The default value of this property is <a href="qstatemachine.html#RestorePolicy-enum">QStateMachine::DontRestoreProperties</a>.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QStateMachine::RestorePolicy </td><td class="memItemRight" valign="bottom"><b>globalRestorePolicy</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setGlobalRestorePolicy</b> ( QStateMachine::RestorePolicy <i>restorePolicy</i> )</td></tr>
</table>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QStateMachine/QStateMachine"></a>
<h3 class="fn"><a name="QStateMachine"></a>QStateMachine::QStateMachine ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a new state machine with the given <i>parent</i>.</p>
<a name="//apple_ref/cpp/instm/QStateMachine/~QStateMachine"></a>
<h3 class="fn"><a name="dtor.QStateMachine"></a>QStateMachine::~QStateMachine ()</h3>
<p>Destroys this state machine.</p>
<a name="//apple_ref/cpp/instm/QStateMachine/addDefaultAnimation"></a>
<h3 class="fn"><a name="addDefaultAnimation"></a>void QStateMachine::addDefaultAnimation ( <a href="qabstractanimation.html">QAbstractAnimation</a> * <i>animation</i> )</h3>
<p>Adds a default <i>animation</i> to be considered for any transition.</p>
<a name="//apple_ref/cpp/instm/QStateMachine/addState"></a>
<h3 class="fn"><a name="addState"></a>void QStateMachine::addState ( <a href="qabstractstate.html">QAbstractState</a> * <i>state</i> )</h3>
<p>Adds the given <i>state</i> to this state machine. The state becomes a top-level state.</p>
<p>If the state is already in a different machine, it will first be removed from its old machine, and then added to this machine.</p>
<p>See also <a href="qstatemachine.html#removeState">removeState</a>() and <a href="qstate.html#initialState-prop">setInitialState</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/cancelDelayedEvent"></a>
<h3 class="fn"><a name="cancelDelayedEvent"></a>bool QStateMachine::cancelDelayedEvent ( int <i>id</i> )</h3>
<p>Cancels the delayed event identified by the given <i>id</i>. The id should be a value returned by a call to <a href="qstatemachine.html#postDelayedEvent">postDelayedEvent</a>(). Returns true if the event was successfully cancelled, otherwise returns false.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p>See also <a href="qstatemachine.html#postDelayedEvent">postDelayedEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/clearError"></a>
<h3 class="fn"><a name="clearError"></a>void QStateMachine::clearError ()</h3>
<p>Clears the error string and error code of the state machine.</p>
<a name="//apple_ref/cpp/instm/QStateMachine/configuration"></a>
<h3 class="fn"><a name="configuration"></a><a href="qset.html">QSet</a>&lt;<a href="qabstractstate.html">QAbstractState</a> *&gt; QStateMachine::configuration () const</h3>
<p>Returns the maximal consistent set of states (including parallel and final states) that this state machine is currently in. If a state <tt>s</tt> is in the configuration, it is always the case that the parent of <tt>s</tt> is also in c. Note, however, that the machine itself is not an explicit member of the configuration.</p>
<a name="//apple_ref/cpp/instm/QStateMachine/defaultAnimations"></a>
<h3 class="fn"><a name="defaultAnimations"></a><a href="qlist.html">QList</a>&lt;<a href="qabstractanimation.html">QAbstractAnimation</a> *&gt; QStateMachine::defaultAnimations () const</h3>
<p>Returns the list of default animations that will be considered for any transition.</p>
<a name="//apple_ref/cpp/instm/QStateMachine/error"></a>
<h3 class="fn"><a name="error"></a><a href="qstatemachine.html#Error-enum">Error</a> QStateMachine::error () const</h3>
<p>Returns the error code of the last error that occurred in the state machine.</p>
<a name="//apple_ref/cpp/instm/QStateMachine/event"></a>
<h3 class="fn"><a name="event"></a>bool QStateMachine::event ( <a href="qevent.html">QEvent</a> * <i>e</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/eventFilter"></a>
<h3 class="fn"><a name="eventFilter"></a>bool QStateMachine::eventFilter ( <a href="qobject.html">QObject</a> * <i>watched</i>, <a href="qevent.html">QEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Reimplemented from <a href="qobject.html#eventFilter">QObject::eventFilter</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/isRunning"></a>
<h3 class="fn"><a name="isRunning"></a>bool QStateMachine::isRunning () const</h3>
<p>Returns whether this state machine is running.</p>
<p><a href="qstatemachine.html#start">start</a>(), <a href="qstatemachine.html#stop">stop</a>()</p>
<a name="//apple_ref/cpp/instm/QStateMachine/onEntry"></a>
<h3 class="fn"><a name="onEntry"></a>void QStateMachine::onEntry ( <a href="qevent.html">QEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qabstractstate.html#onEntry">QAbstractState::onEntry</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/onExit"></a>
<h3 class="fn"><a name="onExit"></a>void QStateMachine::onExit ( <a href="qevent.html">QEvent</a> * <i>event</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qabstractstate.html#onExit">QAbstractState::onExit</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/postDelayedEvent"></a>
<h3 class="fn"><a name="postDelayedEvent"></a>int QStateMachine::postDelayedEvent ( <a href="qevent.html">QEvent</a> * <i>event</i>, int <i>delay</i> )</h3>
<p>Posts the given <i>event</i> for processing by this state machine, with the given <i>delay</i> in milliseconds. Returns an identifier associated with the delayed event, or -1 if the event could not be posted.</p>
<p>This function returns immediately. When the delay has expired, the event will be added to the state machine's event queue for processing. The state machine takes ownership of the event and deletes it once it has been processed.</p>
<p>You can only post events when the state machine is running.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p>See also <a href="qstatemachine.html#cancelDelayedEvent">cancelDelayedEvent</a>() and <a href="qstatemachine.html#postEvent">postEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/postEvent"></a>
<h3 class="fn"><a name="postEvent"></a>void QStateMachine::postEvent ( <a href="qevent.html">QEvent</a> * <i>event</i>, <a href="qstatemachine.html#EventPriority-enum">EventPriority</a> <i>priority</i> = NormalPriority )</h3>
<p>Posts the given <i>event</i> of the given <i>priority</i> for processing by this state machine.</p>
<p>This function returns immediately. The event is added to the state machine's event queue. Events are processed in the order posted. The state machine takes ownership of the event and deletes it once it has been processed.</p>
<p>You can only post events when the state machine is running.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p>See also <a href="qstatemachine.html#postDelayedEvent">postDelayedEvent</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/removeDefaultAnimation"></a>
<h3 class="fn"><a name="removeDefaultAnimation"></a>void QStateMachine::removeDefaultAnimation ( <a href="qabstractanimation.html">QAbstractAnimation</a> * <i>animation</i> )</h3>
<p>Removes <i>animation</i> from the list of default animations.</p>
<a name="//apple_ref/cpp/instm/QStateMachine/removeState"></a>
<h3 class="fn"><a name="removeState"></a>void QStateMachine::removeState ( <a href="qabstractstate.html">QAbstractState</a> * <i>state</i> )</h3>
<p>Removes the given <i>state</i> from this state machine. The state machine releases ownership of the state.</p>
<p>See also <a href="qstatemachine.html#addState">addState</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/start"></a>
<h3 class="fn"><a name="start"></a>void QStateMachine::start ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Starts this state machine. The machine will reset its configuration and transition to the initial state. When a final top-level state (<a href="qfinalstate.html">QFinalState</a>) is entered, the machine will emit the <a href="qstate.html#finished">finished</a>() signal.</p>
<p><b>Note:</b> A state machine will not run without a running event loop, such as the main application event loop started with <a href="qcoreapplication.html#exec">QCoreApplication::exec</a>() or <a href="qapplication.html#exec">QApplication::exec</a>().</p>
<p>See also <a href="qstatemachine.html#started">started</a>(), <a href="qstate.html#finished">finished</a>(), <a href="qstatemachine.html#stop">stop</a>(), and <a href="qstate.html#initialState-prop">initialState</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/started"></a>
<h3 class="fn"><a name="started"></a>void QStateMachine::started ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted when the state machine has entered its initial state (<a href="qstate.html#initialState-prop">QStateMachine::initialState</a>).</p>
<p>See also <a href="qstate.html#finished">QStateMachine::finished</a>() and <a href="qstatemachine.html#start">QStateMachine::start</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/stop"></a>
<h3 class="fn"><a name="stop"></a>void QStateMachine::stop ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Stops this state machine. The state machine will stop processing events and then emit the <a href="qstatemachine.html#stopped">stopped</a>() signal.</p>
<p>See also <a href="qstatemachine.html#stopped">stopped</a>() and <a href="qstatemachine.html#start">start</a>().</p>
<a name="//apple_ref/cpp/instm/QStateMachine/stopped"></a>
<h3 class="fn"><a name="stopped"></a>void QStateMachine::stopped ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted when the state machine has stopped.</p>
<p>See also <a href="qstatemachine.html#stop">QStateMachine::stop</a>() and <a href="qstate.html#finished">QStateMachine::finished</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>