<?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>QState 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">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QState Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QState class provides a general-purpose state for <a href="qstatemachine.html">QStateMachine</a>. <a href="#details">More...</a></p> <p>Inherits <a href="qabstractstate.html">QAbstractState</a>.</p><p>Inherited by <a href="qstatemachine.html">QStateMachine</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qstate.html#ChildMode-enum">ChildMode</a></b> { ExclusiveStates, ParallelStates }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qstate.html#QState">__init__</a></b> (<i>self</i>, QState <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qstate.html#QState-2">__init__</a></b> (<i>self</i>, ChildMode <i>childMode</i>, QState <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qstate.html#addTransition">addTransition</a></b> (<i>self</i>, QAbstractTransition <i>transition</i>)</li><li><div class="fn" />QSignalTransition <b><a href="qstate.html#addTransition-2">addTransition</a></b> (<i>self</i>, QObject <i>sender</i>, SIGNAL() <i>signal</i>, QAbstractState <i>target</i>)</li><li><div class="fn" />QSignalTransition <b><a href="qstate.html#addTransition-3">addTransition</a></b> (<i>self</i>, signal <i>signal</i>, QAbstractState <i>target</i>)</li><li><div class="fn" />QAbstractTransition <b><a href="qstate.html#addTransition-4">addTransition</a></b> (<i>self</i>, QAbstractState <i>target</i>)</li><li><div class="fn" /><b><a href="qstate.html#assignProperty">assignProperty</a></b> (<i>self</i>, QObject <i>object</i>, str <i>name</i>, QVariant <i>value</i>)</li><li><div class="fn" />ChildMode <b><a href="qstate.html#childMode">childMode</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractState <b><a href="qstate.html#errorState">errorState</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qstate.html#event">event</a></b> (<i>self</i>, QEvent <i>e</i>)</li><li><div class="fn" />QAbstractState <b><a href="qstate.html#initialState">initialState</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qstate.html#onEntry">onEntry</a></b> (<i>self</i>, QEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qstate.html#onExit">onExit</a></b> (<i>self</i>, QEvent <i>event</i>)</li><li><div class="fn" /><b><a href="qstate.html#removeTransition">removeTransition</a></b> (<i>self</i>, QAbstractTransition <i>transition</i>)</li><li><div class="fn" /><b><a href="qstate.html#setChildMode">setChildMode</a></b> (<i>self</i>, ChildMode <i>mode</i>)</li><li><div class="fn" /><b><a href="qstate.html#setErrorState">setErrorState</a></b> (<i>self</i>, QAbstractState <i>state</i>)</li><li><div class="fn" /><b><a href="qstate.html#setInitialState">setInitialState</a></b> (<i>self</i>, QAbstractState <i>state</i>)</li><li><div class="fn" />list-of-QAbstractTransition <b><a href="qstate.html#transitions">transitions</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qstate.html#finished">finished</a></b> ()</li><li><div class="fn" />void <b><a href="qstate.html#propertiesAssigned">propertiesAssigned</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QState class provides a general-purpose state for <a href="qstatemachine.html">QStateMachine</a>.</p> <p>QState objects can have child states, and can have transitions to other states. QState is part of <a href="statemachine-api.html">The State Machine Framework</a>.</p> <p>The <a href="qstate.html#addTransition">addTransition</a>() function adds a transition. The <a href="qstate.html#removeTransition">removeTransition</a>() function removes a transition. The <a href="qstate.html#transitions">transitions</a>() function returns the state's outgoing transitions.</p> <p>The <a href="qstate.html#assignProperty">assignProperty</a>() function is used for defining property assignments that should be performed when a state is entered.</p> <p>Top-level states must be passed a <a href="qstatemachine.html">QStateMachine</a> object as their parent state, or added to a state machine using <a href="qstatemachine.html#addState">QStateMachine.addState</a>().</p> <a id="states-with-child-states" name="states-with-child-states" /> <h3>States with Child States</h3> <p>The <a href="qstate.html#childMode-prop">childMode</a> property determines how child states are treated. For non-parallel state groups, the <a href="qstate.html#initialState-prop">setInitialState</a>() function must be called to set the initial state. The child states are mutually exclusive states, and the state machine needs to know which child state to enter when the parent state is the target of a transition.</p> <p>The state emits the <a href="qstate.html#finished">QState.finished</a>() signal when a final child state (<a href="qfinalstate.html">QFinalState</a>) is entered.</p> <p>The <a href="qstate.html#errorState-prop">setErrorState</a>() sets the state's error state. The error state is the state that the state machine will transition to if an error is detected when attempting to enter the state (e.g. because no initial state has been set).</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ChildMode-enum" />QState.ChildMode</h3><p>This enum specifies how a state's child states are treated.</p> <table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QState.ExclusiveStates</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">The child states are mutually exclusive and an initial state must be set by calling <a href="qstate.html#initialState-prop">QState.setInitialState</a>().</td> </tr> <tr> <td class="topAlign"><tt>QState.ParallelStates</tt></td> <td class="topAlign"><tt>1</tt></td> <td class="topAlign">The child states are parallel. When the parent state is entered, all its child states are entered in parallel.</td> </tr> </table> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QState" />QState.__init__ (<i>self</i>, <a href="qstate.html">QState</a> <i>parent</i> = 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 state with the given <i>parent</i> state.</p> <h3 class="fn"><a name="QState-2" />QState.__init__ (<i>self</i>, <a href="qstate.html#ChildMode-enum">ChildMode</a> <i>childMode</i>, <a href="qstate.html">QState</a> <i>parent</i> = 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 state with the given <i>childMode</i> and the given <i>parent</i> state.</p> <h3 class="fn"><a name="addTransition" />QState.addTransition (<i>self</i>, <a href="qabstracttransition.html">QAbstractTransition</a> <i>transition</i>)</h3><p>The <i>transition</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>transition</i>. The transition has this state as the source. This state takes ownership of the transition.</p> <h3 class="fn"><a name="addTransition-2" /><a href="qsignaltransition.html">QSignalTransition</a> QState.addTransition (<i>self</i>, <a href="qobject.html">QObject</a> <i>sender</i>, SIGNAL() <i>signal</i>, <a href="qabstractstate.html">QAbstractState</a> <i>target</i>)</h3><p>Adds a transition associated with the given <i>signal</i> of the given <i>sender</i> object, and returns the new <a href="qsignaltransition.html">QSignalTransition</a> object. The transition has this state as the source, and the given <i>target</i> as the target state.</p> <h3 class="fn"><a name="addTransition-3" /><a href="qsignaltransition.html">QSignalTransition</a> QState.addTransition (<i>self</i>, signal <i>signal</i>, <a href="qabstractstate.html">QAbstractState</a> <i>target</i>)</h3><p>Adds an unconditional transition from this state to the given <i>target</i> state, and returns then new transition object.</p> <h3 class="fn"><a name="addTransition-4" /><a href="qabstracttransition.html">QAbstractTransition</a> QState.addTransition (<i>self</i>, <a href="qabstractstate.html">QAbstractState</a> <i>target</i>)</h3><p>The <i>target</i> argument has it's ownership transferred to Qt.</p><h3 class="fn"><a name="assignProperty" />QState.assignProperty (<i>self</i>, <a href="qobject.html">QObject</a> <i>object</i>, str <i>name</i>, QVariant <i>value</i>)</h3><p>Instructs this state to set the property with the given <i>name</i> of the given <i>object</i> to the given <i>value</i> when the state is entered.</p> <p><b>See also</b> <a href="qstate.html#propertiesAssigned">propertiesAssigned</a>().</p> <h3 class="fn"><a name="childMode" /><a href="qstate.html#ChildMode-enum">ChildMode</a> QState.childMode (<i>self</i>)</h3><h3 class="fn"><a name="errorState" /><a href="qabstractstate.html">QAbstractState</a> QState.errorState (<i>self</i>)</h3><h3 class="fn"><a name="event" />bool QState.event (<i>self</i>, <a href="qevent.html">QEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="initialState" /><a href="qabstractstate.html">QAbstractState</a> QState.initialState (<i>self</i>)</h3><h3 class="fn"><a name="onEntry" />QState.onEntry (<i>self</i>, <a href="qevent.html">QEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qabstractstate.html#onEntry">QAbstractState.onEntry</a>().</p> <h3 class="fn"><a name="onExit" />QState.onExit (<i>self</i>, <a href="qevent.html">QEvent</a> <i>event</i>)</h3><p>Reimplemented from <a href="qabstractstate.html#onExit">QAbstractState.onExit</a>().</p> <h3 class="fn"><a name="removeTransition" />QState.removeTransition (<i>self</i>, <a href="qabstracttransition.html">QAbstractTransition</a> <i>transition</i>)</h3><p>The <i>transition</i> argument</p><p>Removes the given <i>transition</i> from this state. The state releases ownership of the transition.</p> <p><b>See also</b> <a href="qstate.html#addTransition">addTransition</a>().</p> <h3 class="fn"><a name="setChildMode" />QState.setChildMode (<i>self</i>, <a href="qstate.html#ChildMode-enum">ChildMode</a> <i>mode</i>)</h3><h3 class="fn"><a name="setErrorState" />QState.setErrorState (<i>self</i>, <a href="qabstractstate.html">QAbstractState</a> <i>state</i>)</h3><h3 class="fn"><a name="setInitialState" />QState.setInitialState (<i>self</i>, <a href="qabstractstate.html">QAbstractState</a> <i>state</i>)</h3><h3 class="fn"><a name="transitions" />list-of-QAbstractTransition QState.transitions (<i>self</i>)</h3><p>Returns this state's outgoing transitions (i.e. transitions where this state is the <a href="qabstracttransition.html#sourceState-prop">source state</a>), or an empty list if this state has no outgoing transitions.</p> <p>This function was introduced in Qt 4.7.</p> <p><b>See also</b> <a href="qstate.html#addTransition">addTransition</a>().</p> <hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="finished" />void finished ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when a final child state of this state is entered.</p> <p><b>See also</b> <a href="qfinalstate.html">QFinalState</a>.</p> <h3 class="fn"><a name="propertiesAssigned" />void propertiesAssigned ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when all properties have been assigned their final value. If the state assigns a value to one or more properties for which an animation exists (either set on the transition or as a default animation on the state machine), then the signal will not be emitted until all such animations have finished playing.</p> <p>If there are no relevant animations, or no property assignments defined for the state, then the signal will be emitted immediately before the state is entered.</p> <p><b>See also</b> <a href="qstate.html#assignProperty">QState.assignProperty</a>() and <a href="qabstracttransition.html#addAnimation">QAbstractTransition.addAnimation</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>