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
|
<?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>QDBusReply 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">QDBusReply Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusReply class stores the reply for a method call to a
remote object. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusreply.html#QDBusReply">__init__</a></b> (<i>self</i>, QDBusMessage <i>reply</i>)</li><li><div class="fn" /><b><a href="qdbusreply.html#QDBusReply-2">__init__</a></b> (<i>self</i>, QDBusPendingCall <i>call</i>)</li><li><div class="fn" /><b><a href="qdbusreply.html#QDBusReply-3">__init__</a></b> (<i>self</i>, QDBusError <i>error</i>)</li><li><div class="fn" /><b><a href="qdbusreply.html#QDBusReply-4">__init__</a></b> (<i>self</i>, QDBusReply <i>other</i>)</li><li><div class="fn" />QDBusError <b><a href="qdbusreply.html#error">error</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdbusreply.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />object <b><a href="qdbusreply.html#value">value</a></b> (<i>self</i>, object <i>type</i> = None)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusReply class stores the reply for a method call to a
remote object.</p>
<p>A QDBusReply object is a subset of the <a href="qdbusmessage.html">QDBusMessage</a> object that represents a
method call's reply. It contains only the first output argument or
the error code and is used by <a href="qdbusinterface.html">QDBusInterface</a>-derived classes to allow
returning the error code as the function's return argument.</p>
<p>It can be used in the following manner:</p>
<pre class="cpp">
<span class="type">QDBusReply</span><span class="operator"><</span><span class="type"><a href="qstring.html">QString</a></span><span class="operator">></span> reply <span class="operator">=</span> interface<span class="operator">-</span><span class="operator">></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>If the remote method call cannot fail, you can skip the error
checking:</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">></span>call(<span class="string">"RemoteMethod"</span>);
</pre>
<p>However, if it does fail under those conditions, the value
returned by <a href="qdbusreply.html#value">QDBusReply.value</a>()
is a default-constructed value. It may be indistinguishable from a
valid return value.</p>
<p>QDBusReply objects are used for remote calls that have no output
arguments or return values (i.e., they have a "void" return type).
Use the <a href="qdbusreply.html#isValid">isValid</a>() function to
test if the reply succeeded.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusReply" />QDBusReply.__init__ (<i>self</i>, <a href="qdbusmessage.html">QDBusMessage</a> <i>reply</i>)</h3><p>Automatically construct a <a href="qdbusreply.html">QDBusReply</a> object from the reply message
<i>reply</i>, extracting the first return value from it if it is a
success reply.</p>
<h3 class="fn"><a name="QDBusReply-2" />QDBusReply.__init__ (<i>self</i>, <a href="qdbuspendingcall.html">QDBusPendingCall</a> <i>call</i>)</h3><p>Automatically construct a <a href="qdbusreply.html">QDBusReply</a> object from the asynchronous
pending call <i>pcall</i>. If the call isn't finished yet, <a href="qdbusreply.html">QDBusReply</a> will call
QDBusPendingCall.waitForFinished(), which is a blocking
operation.</p>
<p>If the return types patch, <a href="qdbusreply.html">QDBusReply</a> will extract the first return
argument from the reply.</p>
<h3 class="fn"><a name="QDBusReply-3" />QDBusReply.__init__ (<i>self</i>, <a href="qdbuserror.html">QDBusError</a> <i>error</i>)</h3><p>Constructs a <a href="qdbusreply.html">QDBusReply</a> object
from the pending reply message, <i>reply</i>.</p>
<h3 class="fn"><a name="QDBusReply-4" />QDBusReply.__init__ (<i>self</i>, <a href="qdbusreply.html">QDBusReply</a> <i>other</i>)</h3><p>Constructs an error reply from the D-Bus error code given by
<i>error</i>.</p>
<h3 class="fn"><a name="error" /><a href="qdbuserror.html">QDBusError</a> QDBusReply.error (<i>self</i>)</h3><p>Returns the error code that was returned from the remote
function call. If the remote call did not return an error (i.e., if
it succeeded), then the <a href="qdbuserror.html">QDBusError</a>
object that is returned will not be a valid error code (<a href="qdbuserror.html#isValid">QDBusError.isValid</a>() will return
false).</p>
<p><b>See also</b> <a href="qdbusreply.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="isValid" />bool QDBusReply.isValid (<i>self</i>)</h3><p>Returns true if no error occurred; otherwise, returns false.</p>
<p><b>See also</b> <a href="qdbusreply.html#error">error</a>().</p>
<h3 class="fn"><a name="value" />object QDBusReply.value (<i>self</i>, object <i>type</i> = None)</h3><p>Returns the remote function's calls return value. If the remote
call returned with an error, the return value of this function is
undefined and may be undistinguishable from a valid return
value.</p>
<p>This function is not available if the remote call returns
<tt>void</tt>.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|