<?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"> <!-- qdbusextratypes.cpp --> <head> <title>Qt 4.6: QDBusVariant Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <a name="//apple_ref/cpp/cl//QDBusVariant"></a> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" 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="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QDBusVariant Class Reference<br /><span class="small-subtitle">[<a href="qtdbus.html">QtDBus</a> module]</span> </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> <pre> #include <QDBusVariant></pre><p>Inherits <a href="qvariant.html">QVariant</a> (private).</p> <p>This class was introduced in Qt 4.2.</p> <ul> <li><a href="qdbusvariant-members.html">List of all members, including inherited members</a></li> </ul> <hr /> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qdbusvariant.html#QDBusVariant">QDBusVariant</a></b> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qdbusvariant.html#QDBusVariant-2">QDBusVariant</a></b> ( const QVariant & <i>variant</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qdbusvariant.html#setVariant">setVariant</a></b> ( const QVariant & <i>variant</i> )</td></tr> <tr><td class="memItemLeft" align="right" valign="top">QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qdbusvariant.html#variant">variant</a></b> () const</td></tr> </table> <ul> <li><div bar="2" class="fn"></div>44 public functions inherited from <a href="qvariant.html#public-functions">QVariant</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li><div class="fn"></div>3 static public members inherited from <a href="qvariant.html#static-public-members">QVariant</a></li> </ul> <a name="details"></a> <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> QList<QVariant> arguments; arguments << QVariant(42) << QVariant::fromValue(QDBusVariant(43)) << QVariant("hello"); myDBusMessage.setArguments(arguments);</pre> <p>When a D-Bus function returns a D-Bus variant, it can be retrieved as follows:</p> <pre> <span class="comment">// call a D-Bus function that returns a D-Bus variant</span> QVariant v = callMyDBusFunction(); <span class="comment">// retrieve the D-Bus variant</span> QDBusVariant dbusVariant = qvariant_cast<QDBusVariant>(v); <span class="comment">// retrieve the actual value stored in the D-Bus variant</span> QVariant result = dbusVariant.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> <p>See also <a href="qdbustypesystem.html">The QtDBus type system</a>.</p> <hr /> <h2>Member Function Documentation</h2> <a name="//apple_ref/cpp/instm/QDBusVariant/QDBusVariant"></a> <h3 class="fn"><a name="QDBusVariant"></a>QDBusVariant::QDBusVariant ()</h3> <p>Constructs a new D-Bus variant.</p> <h3 class="fn"><a name="QDBusVariant-2"></a>QDBusVariant::QDBusVariant ( const <a href="qvariant.html">QVariant</a> & <i>variant</i> )</h3> <p>Constructs a new D-Bus variant from the given Qt <i>variant</i>.</p> <p>See also <a href="qdbusvariant.html#setVariant">setVariant</a>().</p> <a name="//apple_ref/cpp/instm/QDBusVariant/setVariant"></a> <h3 class="fn"><a name="setVariant"></a>void QDBusVariant::setVariant ( const <a href="qvariant.html">QVariant</a> & <i>variant</i> )</h3> <p>Assigns the value of the given Qt <i>variant</i> to this D-Bus variant.</p> <p>See also <a href="qdbusvariant.html#variant">variant</a>().</p> <a name="//apple_ref/cpp/instm/QDBusVariant/variant"></a> <h3 class="fn"><a name="variant"></a><a href="qvariant.html">QVariant</a> QDBusVariant::variant () const</h3> <p>Returns this D-Bus variant as a <a href="qvariant.html">QVariant</a> object.</p> <p>See also <a href="qdbusvariant.html#setVariant">setVariant</a>().</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="40%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.3</div></td> </tr></table></div></address></body> </html>