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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- dbus-adaptors.qdoc -->
<title>Qt 4.8: Using QtDBus Adaptors</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li>Using QtDBus Adaptors</li>
</ul>
</div>
</div>
<div class="content mainContent">
<h1 class="title">Using QtDBus Adaptors</h1>
<span class="subtitle"></span>
<!-- $$$usingadaptors.html-description -->
<div class="descr"> <a name="details"></a>
<p>Adaptors are special classes that are attached to any <a href="qobject.html">QObject</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 <a href="qdbusabstractadaptor.html">QDBusAbstractAdaptor</a>. Since that is a standard <a href="qobject.html">QObject</a>-derived class, the <a href="qobject.html#Q_OBJECT">Q_OBJECT</a> macro must appear in the declaration and the source file must be processed with the <a href="moc.html#moc">moc</a> tool. The class must also contain one Q_CLASSINFO entry with the <tt>"D-Bus Interface"</tt> name, declaring which interface it is exporting. Only one entry per class is supported.</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</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">The QtDBus Type System</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="qobject.html">QObject</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</a></li>
<li><a href="qdbusdeclaringsignals.html">Declaring Signals in D-Bus Adaptors</a></li>
<li><a href="qdbustypesystem.html">The QtDBus Type System</a></li>
<li><a href="qdbusadaptorexample.html">D-Bus Adaptor Example</a></li>
</ul>
</div>
<p><b>See also </b><a href="qdbusabstractadaptor.html">QDBusAbstractAdaptor</a>.</p>
<!-- @@@usingadaptors.html -->
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|