<?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"> <!-- /builddir/build/BUILD/libqxt-libqxt-v0.6.2/src/core/qxtsignalgroup.cpp --> <head> <title>QxtSignalGroup Class Reference</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://libqxt.org"><img src="images/qxt-logo.png" width="50" height="40" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="classes.html"><font color="#004faf">Classes</font></a> · <a href="namespaces.html"><font color="#004faf">Namespaces</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QxtSignalGroup Class Reference<br /><span class="small-subtitle">[<a href="qxtcore.html">QxtCore</a> module]</span> </h1> <p>The QxtSignalGroup class groups signals together in a Boolean fashion <a href="#details">More...</a></p> <pre> #include <QxtSignalGroup></pre><p>Inherits <a href="http://doc.qtsoftware.com/4.5/qobject.html">QObject</a>.</p> <p>Inherited by <a href="qxtmultisignalwaiter.html">QxtMultiSignalWaiter</a>.</p> <ul> <li><a href="qxtsignalgroup-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"></div><b><a href="qxtsignalgroup.html#QxtSignalGroup">QxtSignalGroup</a></b> ( QObject * <i>parent</i> = 0 )</li> <li><div class="fn"></div>void <b><a href="qxtsignalgroup.html#addSignal">addSignal</a></b> ( QObject * <i>sender</i>, const char * <i>sig</i> )</li> <li><div class="fn"></div>void <b><a href="qxtsignalgroup.html#clear">clear</a></b> ()</li> <li><div class="fn"></div>bool <b><a href="qxtsignalgroup.html#hasReceivedAllSignals">hasReceivedAllSignals</a></b> () const</li> <li><div class="fn"></div>bool <b><a href="qxtsignalgroup.html#hasReceivedFirstSignal">hasReceivedFirstSignal</a></b> () const</li> <li><div class="fn"></div>void <b><a href="qxtsignalgroup.html#removeSignal">removeSignal</a></b> ( QObject * <i>sender</i>, const char * <i>sig</i> = 0 )</li> </ul> <ul> <li><div class="fn"></div>29 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-functions">QObject</a></li> </ul> <a name="public-slots"></a> <h3>Public Slots</h3> <ul> <li><div class="fn"></div>void <b><a href="qxtsignalgroup.html#reset">reset</a></b> ()</li> </ul> <ul> <li><div class="fn"></div>1 public slot inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-slots">QObject</a></li> </ul> <a name="signals"></a> <h3>Signals</h3> <ul> <li><div class="fn"></div>void <b><a href="qxtsignalgroup.html#allSignalsReceived">allSignalsReceived</a></b> ()</li> <li><div class="fn"></div>void <b><a href="qxtsignalgroup.html#firstSignalReceived">firstSignalReceived</a></b> ()</li> </ul> <ul> <li><div class="fn"></div>1 signal inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#signals">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li><div class="fn"></div>1 property inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#properties">QObject</a></li> <li><div class="fn"></div>1 public type inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-variables">QObject</a></li> <li><div class="fn"></div>4 static public members inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#static-public-members">QObject</a></li> <li><div class="fn"></div>7 protected functions inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#protected-functions">QObject</a></li> <li><div class="fn"></div>2 protected variables inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#protected-variables">QObject</a></li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QxtSignalGroup class groups signals together in a Boolean fashion</p> <p>When carrying out multiple tasks in parallel, it can be useful to know when any or all of the tasks have emitted a signal. This class allows a group of signals to be defined and re-signalled in a simple AND or OR fashion. More complex Boolean relationships can be written by connecting together multiple QxtSignalGroup objects.</p> <p>For a simple example, suppose you have four <a href="http://doc.qtsoftware.com/4.5/qhttp.html">QHttp</a> requests pending and you want to know when the last request has completed. A QxtSignalGroup defined like this will emit its <a href="qxtsignalgroup.html#allSignalsReceived">allSignalsReceived</a>() signal after each request has emitted its done() signal.</p> <pre> QxtSignalGroup* group = new QxtSignalGroup; for(int i = 0; i < 4; i++) { group->addSignal(http[i], SIGNAL(done())); }</pre> <p>For a more complex example, suppose you have two such batches of requests, and you want a signal to be emitted when the first batch is completed. Create two QxtSignalGroup objects (perhaps group1 and group2) and add their signals to a third group. This third group will emit its <a href="qxtsignalgroup.html#firstSignalReceived">firstSignalReceived</a>() signal when the first batch is completed and its <a href="qxtsignalgroup.html#allSignalsReceived">allSignalsReceived</a>() signal when all batches are finished.</p> <pre> QxtSignalGroup* batches = new QxtSignalGroup; batches->addSignal(group1, SIGNAL(allSignalsReceived())); batches->addSignal(group2, SIGNAL(allSignalsReceived()));</pre> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QxtSignalGroup"></a>QxtSignalGroup::QxtSignalGroup ( <a href="http://doc.qtsoftware.com/4.5/qobject.html">QObject</a> * <i>parent</i> = 0 )</h3> <p>Constructs a <a href="qxtsignalwaiter.html">QxtSignalWaiter</a> with the specified <i>parent</i>.</p> <h3 class="fn"><a name="addSignal"></a>void QxtSignalGroup::addSignal ( <a href="http://doc.qtsoftware.com/4.5/qobject.html">QObject</a> * <i>sender</i>, const char * <i>sig</i> )</h3> <p>Add a signal from <i>sender</i> with signature <i>sig</i> to the group.</p> <h3 class="fn"><a name="allSignalsReceived"></a>void QxtSignalGroup::allSignalsReceived () <tt> [signal]</tt></h3> <p>This signal is emitted after every signal in the group has been emitted at least once. After this signal is emitted once, you must call <a href="qxtsignalgroup.html#reset">reset</a>() before it can be emitted again.</p> <h3 class="fn"><a name="clear"></a>void QxtSignalGroup::clear ()</h3> <p>Removes all signals from the group and resets the signal tracking.</p> <h3 class="fn"><a name="firstSignalReceived"></a>void QxtSignalGroup::firstSignalReceived () <tt> [signal]</tt></h3> <p>This signal is emitted the first time a signal in the group is emitted. After this signal is emitted once, you must call <a href="qxtsignalgroup.html#reset">reset</a>() before it can be emitted again.</p> <h3 class="fn"><a name="hasReceivedAllSignals"></a>bool QxtSignalGroup::hasReceivedAllSignals () const</h3> <p>Returns <tt>true</tt> if every attached signal has been emitted at least once since the last <a href="qxtsignalgroup.html#reset">reset</a>().</p> <h3 class="fn"><a name="hasReceivedFirstSignal"></a>bool QxtSignalGroup::hasReceivedFirstSignal () const</h3> <p>Returns <tt>true</tt> if at least one attached signal has been emitted since the last <a href="qxtsignalgroup.html#reset">reset</a>().</p> <h3 class="fn"><a name="removeSignal"></a>void QxtSignalGroup::removeSignal ( <a href="http://doc.qtsoftware.com/4.5/qobject.html">QObject</a> * <i>sender</i>, const char * <i>sig</i> = 0 )</h3> <p>Remove a signal from <i>sender</i> with signature <i>sig</i> from the group.</p> <h3 class="fn"><a name="reset"></a>void QxtSignalGroup::reset () <tt> [slot]</tt></h3> <p>Reset the signal tracking, that is, after calling reset() no signals are considered to have been caught.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td align="left">Copyright © 2007-2011 <a href="mailto:foundation@libqxt.org">Qxt Foundation</a></td> <td align="right"><div align="right"> <a href="http://libqxt.org">Qxt</a> 0.6.2</div></td> </tr></table></div></address></body> </html>