<?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"> <!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/tools/qdbus/src/qdbusinterface.cpp --> <head> <title>Qt 4.2: QDBusInterface Class Reference</title> <link href="classic.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://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" 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="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QDBusInterface Class Reference<br /><sup><sup>[<a href="qtdbus.html">QtDBus</a> module]</sup></sup></h1> <p>The QDBusInterface class is a proxy for interfaces on remote objects. <a href="#details">More...</a></p> <pre> #include <QDBusInterface></pre><p>Inherits <a href="qdbusabstractinterface.html">QDBusAbstractInterface</a>.</p> <p>This class was introduced in Qt 4.2.</p> <ul> <li><a href="qdbusinterface-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"/><b><a href="qdbusinterface.html#QDBusInterface-2">QDBusInterface</a></b> ( const QString & <i>service</i>, const QString & <i>path</i>, const QString & <i>interface</i> = QString(), const QDBusConnection & <i>connection</i> = QDBusConnection::sessionBus(), QObject * <i>parent</i> = 0 )</li> <li><div class="fn"/><b><a href="qdbusinterface.html#dtor.QDBusInterface">~QDBusInterface</a></b> ()</li> </ul> <ul> <li><div class="fn"/>10 public functions inherited from <a href="qdbusabstractinterface.html#public-functions">QDBusAbstractInterface</a></li> <li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li> <li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li> <li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li> <li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li> <li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QDBusInterface class is a proxy for interfaces on remote objects.</p> <p>QDBusInterface is a generic accessor class that is used to place calls to remote objects, connect to signals exported by remote objects and get/set the value of remote properties. This class is useful for dynamic access to remote objects: that is, when you do not have a generated code that represents the remote interface.</p> <p>Calls are usually placed by using the <a href="qdbusabstractinterface.html#call">call</a>() function, which constructs the message, sends it over the bus, waits for the reply and decodes the reply. Signals are connected to by using the normal <a href="qobject.html#connect">QObject::connect</a>() function. Finally, properties are accessed using the <a href="qobject.html#property">QObject::property</a>() and <a href="qobject.html#setProperty">QObject::setProperty</a>() functions.</p> <p>The following code snippet demonstrates how to perform a mathematical operation of <tt>"2 + 2"</tt> in a remote application called <tt>com.example.Calculator</tt>, accessed via the session bus.</p> <pre> QDBusInterface remoteApp( "com.example.Calculator", "/Calculator/Operations", "org.mathematics.RPNCalculator" ); remoteApp.call( "PushOperand", 2 ); remoteApp.call( "PushOperand", 2 ); remoteApp.call( "ExecuteOperation", "+" ); QDBusReply<int> reply = remoteApp.call( "PopOperand" ); if ( reply.isValid() ) printf( "%d", reply.value() ); <span class="comment">// prints 4</span></pre> <p>See also <a href="dbusxml2cpp.html">The dbusxml2cpp compiler</a>.</p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QDBusInterface-2"></a>QDBusInterface::QDBusInterface ( const <a href="qstring.html">QString</a> & <i>service</i>, const <a href="qstring.html">QString</a> & <i>path</i>, const <a href="qstring.html">QString</a> & <i>interface</i> = QString(), const <a href="qdbusconnection.html">QDBusConnection</a> & <i>connection</i> = QDBusConnection::sessionBus(), <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3> <p>Creates a dynamic <a href="qdbusinterface.html">QDBusInterface</a> object associated with the interface <i>interface</i> on object at path <i>path</i> on service <i>service</i>, using the given <i>connection</i>. If <i>interface</i> is an empty string, the object created will refer to the merging of all interfaces found in that object.</p> <p><i>parent</i> is passed to the base class constructor.</p> <p>If the remote service <i>service</i> is not present or if an error occurs trying to obtain the description of the remote interface <i>interface</i>, the object created will not be valid (see <a href="qdbusabstractinterface.html#isValid">isValid</a>()).</p> <h3 class="fn"><a name="dtor.QDBusInterface"></a>QDBusInterface::~QDBusInterface ()</h3> <p>Destroy the object interface and frees up any resource used.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright © 2006 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.2.1</div></td> </tr></table></div></address></body> </html>