Sophie

Sophie

distrib > * > 2009.0 > i586 > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2551

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<?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">
<!-- /home/gvatteka/dev/qt-4.3/doc/src/qdbusadaptors.qdoc -->
<head>
  <title>Using QtDBus Adaptors</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 align="center">Using QtDBus Adaptors<br /><small></small></h1>
<p>Adaptors are special classes that are attached to any <a href="core/QObject.html"><tt>QObject</tt></a>-derived class and provide the interface to the external world using D-Bus. Adaptors are intended to be lightweight classes whose main purpose is to relay calls to and from the real object, possibly validating or converting the input from the external world and, thus, protecting the real object.</p>
<p>Unlike multiple inheritance, adaptors can be added at any time to any object (but not removed), which allows for greater flexibility when exporting existing classes. Another advantage of adaptors is to provide similar but not identical functionality in methods of the same name in different interfaces, a case which can be quite common when adding a new version of a standard interface to an object.</p>
<p>In order to use an adaptor, one must create a class which inherits QDBusAbstractAdaptor. Since that is a standard <a href="core/QObject.html"><tt>QObject</tt></a>-derived class, the Q_OBJECT macro must appear in the declaration and the source file must be processed with the <a href="moc.html#moc">moc</tt></a> tool. The class must also contain one or more Q_CLASSINFO entries with the <tt>&quot;D-Bus Interface&quot;</tt> name, declaring which interfaces it is exporting.</p>
<p>Any public slot in the class will be accessible through the bus over messages of the MethodCall type. (See <a href="qdbusdeclaringslots.html">Declaring Slots in D-Bus Adaptors</tt></a> for more information). Signals in the class will be automatically relayed over D-Bus. However, not all types are allowed signals or slots' parameter lists: see <a href="qdbustypesystem.html"><tt>The QtDBus Type System</tt></a> for more information.</p>
<p>Also, any property declared with Q_PROPERTY will be automatically exposed over the Properties interface on D-Bus. Since the <a href="core/QObject.html"><tt>QObject</tt></a> property system does not allow for non-readable properties, it is not possible to declare write-only properties using adaptors.</p>
<p>More information:</p>
<ul>
<li><a href="qdbusdeclaringslots.html">Declaring Slots in D-Bus Adaptors</tt></a></li>
<li><a href="qdbusdeclaringsignals.html">Declaring Signals in D-Bus Adaptors</tt></a></li>
<li><a href="qdbustypesystem.html"><tt>The QtDBus Type System</tt></a></li>
<li><a href="qdbusadaptorexample.html">D-Bus Adaptor Example</tt></a></li>
</ul>
<dl>
<dt><b>See Also:</b></dt>
<dd><tt>QDBusAbstractAdaptor</tt></dd>
</dl>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2007 <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 Jambi </div></td>
</tr></table></div></address></body>
</html>