Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 582

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?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>QDBusPendingReply 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">QDBusPendingReply Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusPendingReply class contains the reply to an
asynchronous method call <a href="#details">More...</a></p>

<p>Inherits <a href="qdbuspendingcall.html">QDBusPendingCall</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbuspendingreply.html#QDBusPendingReply">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdbuspendingreply.html#QDBusPendingReply-2">__init__</a></b> (<i>self</i>, QDBusPendingReply&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qdbuspendingreply.html#QDBusPendingReply-3">__init__</a></b> (<i>self</i>, QDBusPendingCall&#160;<i>call</i>)</li><li><div class="fn" /><b><a href="qdbuspendingreply.html#QDBusPendingReply-4">__init__</a></b> (<i>self</i>, QDBusMessage&#160;<i>reply</i>)</li><li><div class="fn" />QVariant <b><a href="qdbuspendingreply.html#argumentAt">argumentAt</a></b> (<i>self</i>, int&#160;<i>index</i>)</li><li><div class="fn" />QDBusError <b><a href="qdbuspendingreply.html#error">error</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbuspendingreply.html#isError">isError</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbuspendingreply.html#isFinished">isFinished</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbuspendingreply.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />QDBusMessage <b><a href="qdbuspendingreply.html#reply">reply</a></b> (<i>self</i>)</li><li><div class="fn" />object <b><a href="qdbuspendingreply.html#value">value</a></b> (<i>self</i>, object&#160;<i>type</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qdbuspendingreply.html#waitForFinished">waitForFinished</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusPendingReply class contains the reply to an
asynchronous method call</p>
<p>The QDBusPendingReply is a template class with up to 8 template
parameters. Those parameters are the types that will be used to
extract the contents of the reply's data.</p>
<p>This class is similar in functionality to <a href="qdbusreply.html">QDBusReply</a>, but with two important
differences:</p>
<ul>
<li><a href="qdbusreply.html">QDBusReply</a> accepts exactly one
return type, whereas QDBusPendingReply can have from 1 to 8
types</li>
<li><a href="qdbusreply.html">QDBusReply</a> only works on already
completed replies, whereas QDBusPendingReply allows one to wait for
replies from pending calls</li>
</ul>
<p>Where with <a href="qdbusreply.html">QDBusReply</a> you would
write:</p>
<pre class="cpp">
 <span class="type"><a href="qdbusreply.html">QDBusReply</a></span><span class="operator">&lt;</span><span class="type"><a href="qstring.html">QString</a></span><span class="operator">&gt;</span> reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">&gt;</span>call(<span class="string">"RemoteMethod"</span>);
 <span class="keyword">if</span> (reply<span class="operator">.</span>isValid())
     <span class="comment">// use the returned value</span>
     useValue(reply<span class="operator">.</span>value());
 <span class="keyword">else</span>
     <span class="comment">// call failed. Show an error condition.</span>
     showError(reply<span class="operator">.</span>error());
</pre>
<p>with QDBusPendingReply, the equivalent code (including the
blocking wait for the reply) would be:</p>
<pre class="cpp">
     <span class="type">QDBusPendingReply</span><span class="operator">&lt;</span><span class="type"><a href="qstring.html">QString</a></span><span class="operator">&gt;</span> reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">&gt;</span>asyncCall(<span class="string">"RemoteMethod"</span>);
     reply<span class="operator">.</span>waitForFinished();
     <span class="keyword">if</span> (reply<span class="operator">.</span>isError())
         <span class="comment">// call failed. Show an error condition.</span>
         showError(reply<span class="operator">.</span>error());
     <span class="keyword">else</span>
         <span class="comment">// use the returned value</span>
         useValue(reply<span class="operator">.</span>value());
</pre>
<p>For method calls that have more than one output argument, with
<a href="qdbusreply.html">QDBusReply</a>, you would write:</p>
<pre class="cpp">
 <span class="type"><a href="qstring.html">QString</a></span> reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">&gt;</span>call(<span class="string">"RemoteMethod"</span>);
</pre>
<p>whereas with QDBusPendingReply, all of the output arguments
should be template parameters:</p>
<pre class="cpp">
     <span class="type">QDBusPendingReply</span><span class="operator">&lt;</span><span class="type">bool</span><span class="operator">,</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">&gt;</span> reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">&gt;</span>asyncCall(<span class="string">"RemoteMethod"</span>);
     reply<span class="operator">.</span>waitForFinished();
     <span class="keyword">if</span> (<span class="operator">!</span>reply<span class="operator">.</span>isError()) {
         <span class="keyword">if</span> (reply<span class="operator">.</span>argumentAt<span class="operator">&lt;</span><span class="number">0</span><span class="operator">&gt;</span>())
             showSuccess(reply<span class="operator">.</span>argumentAt<span class="operator">&lt;</span><span class="number">1</span><span class="operator">&gt;</span>());
         <span class="keyword">else</span>
             showFailure(reply<span class="operator">.</span>argumentAt<span class="operator">&lt;</span><span class="number">1</span><span class="operator">&gt;</span>());
     }
</pre>
<p>QDBusPendingReply objects can be associated with <a href="qdbuspendingcallwatcher.html">QDBusPendingCallWatcher</a> objects,
which emit signals when the reply arrives.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusPendingReply" />QDBusPendingReply.__init__ (<i>self</i>)</h3><p>Creates an empty <a href="qdbuspendingreply.html">QDBusPendingReply</a> object. Without
assigning a <a href="qdbuspendingcall.html">QDBusPendingCall</a>
object to this reply, <a href="qdbuspendingreply.html">QDBusPendingReply</a> cannot do anything.
All functions return their failure values.</p>


<h3 class="fn"><a name="QDBusPendingReply-2" />QDBusPendingReply.__init__ (<i>self</i>, <a href="qdbuspendingreply.html">QDBusPendingReply</a>&#160;<i>other</i>)</h3><p>Creates a copy of the <i>other</i> <a href="qdbuspendingreply.html">QDBusPendingReply</a> object. Just like
<a href="qdbuspendingcall.html">QDBusPendingCall</a> and <a href="qdbuspendingcallwatcher.html">QDBusPendingCallWatcher</a>, this
<a href="qdbuspendingreply.html">QDBusPendingReply</a> object will
share the same pending call reference. All copies share the same
return values.</p>


<h3 class="fn"><a name="QDBusPendingReply-3" />QDBusPendingReply.__init__ (<i>self</i>, <a href="qdbuspendingcall.html">QDBusPendingCall</a>&#160;<i>call</i>)</h3><p>Creates a <a href="qdbuspendingreply.html">QDBusPendingReply</a>
object that will take its contents from the <i>call</i> pending
asynchronous call. This <a href="qdbuspendingreply.html">QDBusPendingReply</a> object will share
the same pending call reference as <i>call</i>.</p>


<h3 class="fn"><a name="QDBusPendingReply-4" />QDBusPendingReply.__init__ (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a>&#160;<i>reply</i>)</h3><p>Creates a <a href="qdbuspendingreply.html">QDBusPendingReply</a>
object that will take its contents from the message <i>message</i>.
In this case, this object will be already in its finished state and
the reply's contents will be accessible.</p>
<p><b>See also</b> <a href="qdbuspendingreply.html#isFinished">isFinished</a>().</p>


<h3 class="fn"><a name="argumentAt" />QVariant QDBusPendingReply.argumentAt (<i>self</i>, int&#160;<i>index</i>)</h3><p>Returns the argument at position <i>index</i> in the reply's
contents. If the reply doesn't have that many elements, this
function's return value is undefined (will probably cause an
assertion failure), so it is important to verify that the
processing is finished and the reply is valid.</p>


<h3 class="fn"><a name="error" /><a href="qdbuserror.html">QDBusError</a> QDBusPendingReply.error (<i>self</i>)</h3><p>Retrieves the error content of the reply message, if it has
finished processing. If the reply message has not finished
processing or if it contains a normal reply message (non-error),
this function returns an invalid <a href="qdbuserror.html">QDBusError</a>.</p>


<h3 class="fn"><a name="isError" />bool QDBusPendingReply.isError (<i>self</i>)</h3><p>Returns true if the reply contains an error message, false if it
contains a normal method reply.</p>
<p>If the pending call has not finished processing, this function
also returns true.</p>


<h3 class="fn"><a name="isFinished" />bool QDBusPendingReply.isFinished (<i>self</i>)</h3><p>Returns true if the pending call has finished processing and the
reply has been received. If this function returns true, the
<a href="qdbuspendingreply.html#isError">isError</a>(), <a href="qdbuspendingreply.html#error">error</a>() and <a href="qdbuspendingreply.html#reply">reply</a>() methods should return
valid information.</p>
<p>Note that this function only changes state if you call <a href="qdbuspendingreply.html#waitForFinished">waitForFinished</a>() or
if an external D-Bus event happens, which in general only happens
if you return to the event loop execution.</p>
<p><b>See also</b> <a href="qdbuspendingcallwatcher.html#isFinished">QDBusPendingCallWatcher.isFinished</a>().</p>


<h3 class="fn"><a name="isValid" />bool QDBusPendingReply.isValid (<i>self</i>)</h3><p>Returns true if the reply contains a normal reply message, false
if it contains anything else.</p>
<p>If the pending call has not finished processing, this function
return false.</p>


<h3 class="fn"><a name="reply" /><a href="qdbusmessage.html">QDBusMessage</a> QDBusPendingReply.reply (<i>self</i>)</h3><p>Retrieves the reply message received for the asynchronous call
that was sent, if it has finished processing. If the pending call
is not finished, this function returns a <a href="qdbusmessage.html">QDBusMessage</a> of type <a href="qdbusmessage.html#MessageType-enum">QDBusMessage.InvalidMessage</a>.</p>
<p>After it has finished processing, the message type will either
be an error message or a normal method reply message.</p>


<h3 class="fn"><a name="value" />object QDBusPendingReply.value (<i>self</i>, object&#160;<i>type</i>&#160;=&#160;None)</h3><p>Returns the first argument in this reply, cast to type
<tt>T1</tt> (the first template parameter of this class). This is
equivalent to calling argumentAt&lt;0&gt;().</p>
<p>This function is provided as a convenience, matching the
<a href="qdbusreply.html#value">QDBusReply.value</a>()
function.</p>
<p>Note that, if the reply hasn't arrived, this function causes the
calling thread to block until the reply is processed.</p>


<h3 class="fn"><a name="waitForFinished" />QDBusPendingReply.waitForFinished (<i>self</i>)</h3><p>Suspends the execution of the calling thread until the reply is
received and processed. After this function returns, <a href="qdbuspendingreply.html#isFinished">isFinished</a>() should return
true, indicating the reply's contents are ready to be
processed.</p>
<p><b>See also</b> <a href="qdbuspendingcallwatcher.html#waitForFinished">QDBusPendingCallWatcher.waitForFinished</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.10.3 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://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>