1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsignaltransition.cpp -->
<title>Qt 4.8: QSignalTransition Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>QSignalTransition</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QSignalTransition Class Reference</h1>
<!-- $$$QSignalTransition-brief -->
<p>The QSignalTransition class provides a transition based on a Qt signal. <a href="#details">More...</a></p>
<!-- @@@QSignalTransition -->
<pre class="cpp"> <span class="preprocessor">#include <QSignalTransition></span></pre><p><b>Inherits: </b><a href="qabstracttransition.html">QAbstractTransition</a>.</p>
<p>This class was introduced in Qt 4.6.</p>
<ul>
<li><a href="qsignaltransition-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li class="fn"><b><a href="qsignaltransition.html#senderObject-prop">senderObject</a></b> : QObject *</li>
<li class="fn"><b><a href="qsignaltransition.html#signal-prop">signal</a></b> : QByteArray</li>
</ul>
<ul>
<li class="fn">3 properties inherited from <a href="qabstracttransition.html#properties">QAbstractTransition</a></li>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#QSignalTransition">QSignalTransition</a></b> ( QState * <i>sourceState</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#QSignalTransition-2">QSignalTransition</a></b> ( QObject * <i>sender</i>, const char * <i>signal</i>, QState * <i>sourceState</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#dtor.QSignalTransition">~QSignalTransition</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QObject * </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#senderObject-prop">senderObject</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#senderObject-prop">setSenderObject</a></b> ( QObject * <i>sender</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#signal-prop">setSignal</a></b> ( const QByteArray & <i>signal</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#signal-prop">signal</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">9 public functions inherited from <a href="qabstracttransition.html#public-functions">QAbstractTransition</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#event">event</a></b> ( QEvent * <i>e</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#eventTest">eventTest</a></b> ( QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qsignaltransition.html#onTransition">onTransition</a></b> ( QEvent * <i>event</i> )</td></tr>
</table>
<ul>
<li class="fn">3 protected functions inherited from <a href="qabstracttransition.html#protected-functions">QAbstractTransition</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">1 signal inherited from <a href="qabstracttransition.html#signals">QAbstractTransition</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">3 protected functions inherited from <a href="qabstracttransition.html#protected-functions">QAbstractTransition</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<!-- $$$QSignalTransition-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QSignalTransition class provides a transition based on a Qt signal.</p>
<p>Typically you would use the overload of <a href="qstate.html#addTransition">QState::addTransition</a>() that takes a sender and signal as arguments, rather than creating QSignalTransition objects directly. QSignalTransition is part of <a href="statemachine-api.html">The State Machine Framework</a>.</p>
<p>You can subclass QSignalTransition and reimplement <a href="qsignaltransition.html#eventTest">eventTest</a>() to make a signal transition conditional; the event object passed to <a href="qsignaltransition.html#eventTest">eventTest</a>() will be a <a href="qstatemachine-signalevent.html">QStateMachine::SignalEvent</a> object. Example:</p>
<pre class="cpp"> <span class="keyword">class</span> CheckedTransition : <span class="keyword">public</span> <span class="type">QSignalTransition</span>
{
<span class="keyword">public</span>:
CheckedTransition(<span class="type"><a href="qcheckbox.html">QCheckBox</a></span> <span class="operator">*</span>check)
: <span class="type">QSignalTransition</span>(check<span class="operator">,</span> SIGNAL(stateChanged(<span class="type">int</span>))) {}
<span class="keyword">protected</span>:
<span class="type">bool</span> eventTest(<span class="type"><a href="qevent.html">QEvent</a></span> <span class="operator">*</span>e) {
<span class="keyword">if</span> (<span class="operator">!</span><span class="type">QSignalTransition</span><span class="operator">::</span>eventTest(e))
<span class="keyword">return</span> <span class="keyword">false</span>;
<span class="type"><a href="qstatemachine.html">QStateMachine</a></span><span class="operator">::</span>SignalEvent <span class="operator">*</span>se <span class="operator">=</span> <span class="keyword">static_cast</span><span class="operator"><</span><span class="type"><a href="qstatemachine.html">QStateMachine</a></span><span class="operator">::</span>SignalEvent<span class="operator">*</span><span class="operator">></span>(e);
<span class="keyword">return</span> (se<span class="operator">-</span><span class="operator">></span>arguments()<span class="operator">.</span>at(<span class="number">0</span>)<span class="operator">.</span>toInt() <span class="operator">=</span><span class="operator">=</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">::</span>Checked);
}
};
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
<span class="type"><a href="qcheckbox.html">QCheckBox</a></span> <span class="operator">*</span>check <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qcheckbox.html">QCheckBox</a></span>();
check<span class="operator">-</span><span class="operator">></span>setTristate(<span class="keyword">true</span>);
<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"><a href="qstate.html">QState</a></span> <span class="operator">*</span>s2 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstate.html">QState</a></span>();
CheckedTransition <span class="operator">*</span>t1 <span class="operator">=</span> <span class="keyword">new</span> CheckedTransition(check);
t1<span class="operator">-</span><span class="operator">></span><a href="qabstracttransition.html#targetState-prop">setTargetState</a>(s2);
s1<span class="operator">-</span><span class="operator">></span>addTransition(t1);</pre>
</div>
<!-- @@@QSignalTransition -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$senderObject-prop$$$senderObject$$$setSenderObjectQObject* -->
<h3 class="fn"><a name="senderObject-prop"></a><span class="name">senderObject</span> : <span class="type"><a href="qobject.html">QObject</a></span> *</h3>
<p>This property holds the sender object that this signal transition is associated with.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QObject * </td><td class="memItemRight bottomAlign"><span class="name"><b>senderObject</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSenderObject</b></span> ( QObject * <i>sender</i> )</td></tr>
</table>
<!-- @@@senderObject -->
<!-- $$$signal-prop$$$signal$$$setSignalconstQByteArray& -->
<h3 class="fn"><a name="signal-prop"></a><span class="name">signal</span> : <span class="type"><a href="qbytearray.html">QByteArray</a></span></h3>
<p>This property holds the signal that this signal transition is associated with.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QByteArray </td><td class="memItemRight bottomAlign"><span class="name"><b>signal</b></span> () const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSignal</b></span> ( const QByteArray & <i>signal</i> )</td></tr>
</table>
<!-- @@@signal -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSignalTransition[overload1]$$$QSignalTransitionQState* -->
<h3 class="fn"><a name="QSignalTransition"></a>QSignalTransition::<span class="name">QSignalTransition</span> ( <span class="type"><a href="qstate.html">QState</a></span> * <i>sourceState</i> = 0 )</h3>
<p>Constructs a new signal transition with the given <i>sourceState</i>.</p>
<!-- @@@QSignalTransition -->
<!-- $$$QSignalTransition$$$QSignalTransitionQObject*constchar*QState* -->
<h3 class="fn"><a name="QSignalTransition-2"></a>QSignalTransition::<span class="name">QSignalTransition</span> ( <span class="type"><a href="qobject.html">QObject</a></span> * <i>sender</i>, const <span class="type">char</span> * <i>signal</i>, <span class="type"><a href="qstate.html">QState</a></span> * <i>sourceState</i> = 0 )</h3>
<p>Constructs a new signal transition associated with the given <i>signal</i> of the given <i>sender</i>, and with the given <i>sourceState</i>.</p>
<!-- @@@QSignalTransition -->
<!-- $$$~QSignalTransition[overload1]$$$~QSignalTransition -->
<h3 class="fn"><a name="dtor.QSignalTransition"></a>QSignalTransition::<span class="name">~QSignalTransition</span> ()</h3>
<p>Destroys this signal transition.</p>
<!-- @@@~QSignalTransition -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QSignalTransition::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>e</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$eventTest[overload1]$$$eventTestQEvent* -->
<h3 class="fn"><a name="eventTest"></a><span class="type">bool</span> QSignalTransition::<span class="name">eventTest</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qabstracttransition.html#eventTest">QAbstractTransition::eventTest</a>().</p>
<p>The default implementation returns true if the <i>event</i> is a <a href="qstatemachine-signalevent.html">QStateMachine::SignalEvent</a> object and the event's sender and signal index match this transition, and returns false otherwise.</p>
<!-- @@@eventTest -->
<!-- $$$onTransition[overload1]$$$onTransitionQEvent* -->
<h3 class="fn"><a name="onTransition"></a><span class="type">void</span> QSignalTransition::<span class="name">onTransition</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qabstracttransition.html#onTransition">QAbstractTransition::onTransition</a>().</p>
<!-- @@@onTransition -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|