<?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>QDBusVariant 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">QDBusVariant Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1><p>The QDBusVariant class enables the programmer to identify the variant type provided by the D-Bus typesystem. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdbusvariant.html#QDBusVariant">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdbusvariant.html#QDBusVariant-2">__init__</a></b> (<i>self</i>, QVariant <i>variant</i>)</li><li><div class="fn" /><b><a href="qdbusvariant.html#QDBusVariant-3">__init__</a></b> (<i>self</i>, QDBusVariant)</li><li><div class="fn" /><b><a href="qdbusvariant.html#setVariant">setVariant</a></b> (<i>self</i>, QVariant <i>variant</i>)</li><li><div class="fn" />QVariant <b><a href="qdbusvariant.html#variant">variant</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qdbusvariant.html#__eq__">__eq__</a></b> (<i>self</i>, QDBusVariant <i>v2</i>)</li><li><div class="fn" />bool <b><a href="qdbusvariant.html#__ne__">__ne__</a></b> (<i>self</i>, QDBusVariant <i>v2</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDBusVariant class enables the programmer to identify the variant type provided by the D-Bus typesystem.</p> <p>A D-Bus function that takes an integer, a D-Bus variant and a string as parameters can be called with the following argument list (see <a href="qdbusmessage.html#setArguments">QDBusMessage.setArguments</a>()):</p> <pre class="cpp"> <span class="type"><a href="qlist.html">QList</a></span><span class="operator"><</span><span class="type"><a href="qvariant.html">QVariant</a></span><span class="operator">></span> arguments; arguments <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="qvariant.html">QVariant</a></span>(<span class="number">42</span>) <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="qvariant.html">QVariant</a></span><span class="operator">.</span>fromValue(<span class="type">QDBusVariant</span>(<span class="number">43</span>)) <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="qvariant.html">QVariant</a></span>(<span class="string">"hello"</span>); myDBusMessage<span class="operator">.</span>setArguments(arguments); </pre> <p>When a D-Bus function returns a D-Bus variant, it can be retrieved as follows:</p> <pre class="cpp"> <span class="comment">// call a D-Bus function that returns a D-Bus variant</span> <span class="type"><a href="qvariant.html">QVariant</a></span> v <span class="operator">=</span> callMyDBusFunction(); <span class="comment">// retrieve the D-Bus variant</span> <span class="type">QDBusVariant</span> dbusVariant <span class="operator">=</span> qvariant_cast<span class="operator"><</span><span class="type">QDBusVariant</span><span class="operator">></span>(v); <span class="comment">// retrieve the actual value stored in the D-Bus variant</span> <span class="type"><a href="qvariant.html">QVariant</a></span> result <span class="operator">=</span> dbusVariant<span class="operator">.</span>variant(); </pre> <p>The <a href="qvariant.html">QVariant</a> within a QDBusVariant is required to distinguish between a normal D-Bus value and a value within a D-Bus variant.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDBusVariant" />QDBusVariant.__init__ (<i>self</i>)</h3><p>Constructs a new D-Bus variant.</p> <h3 class="fn"><a name="QDBusVariant-2" />QDBusVariant.__init__ (<i>self</i>, QVariant <i>variant</i>)</h3><p>Constructs a new D-Bus variant from the given Qt <i>variant</i>.</p> <p><b>See also</b> <a href="qdbusvariant.html#setVariant">setVariant</a>().</p> <h3 class="fn"><a name="QDBusVariant-3" />QDBusVariant.__init__ (<i>self</i>, <a href="qdbusvariant.html">QDBusVariant</a>)</h3><h3 class="fn"><a name="setVariant" />QDBusVariant.setVariant (<i>self</i>, QVariant <i>variant</i>)</h3><p>Assigns the value of the given Qt <i>variant</i> to this D-Bus variant.</p> <p><b>See also</b> <a href="qdbusvariant.html#variant">variant</a>().</p> <h3 class="fn"><a name="variant" />QVariant QDBusVariant.variant (<i>self</i>)</h3><p>Returns this D-Bus variant as a <a href="qvariant.html">QVariant</a> object.</p> <p><b>See also</b> <a href="qdbusvariant.html#setVariant">setVariant</a>().</p> <h3 class="fn"><a name="__eq__" />bool QDBusVariant.__eq__ (<i>self</i>, <a href="qdbusvariant.html">QDBusVariant</a> <i>v2</i>)</h3><h3 class="fn"><a name="__ne__" />bool QDBusVariant.__ne__ (<i>self</i>, <a href="qdbusvariant.html">QDBusVariant</a> <i>v2</i>)</h3><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>