<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qtdbus-cmake.qdoc --> <title>qt5_add_dbus_adaptor | Qt D-Bus</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtdbus-index.html">Qt D-Bus</a></td><td >qt5_add_dbus_adaptor</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtdbus-index.html">Qt 5.12.6 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#synopsis">Synopsis</a></li> <li class="level1"><a href="#description">Description</a></li> <li class="level1"><a href="#examples">Examples</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">qt5_add_dbus_adaptor</h1> <span class="subtitle"></span> <!-- $$$qtdbus-cmake-qt5-add-dbus-adaptor.html-description --> <div class="descr"> <a name="details"></a> <a name="synopsis"></a> <h2 id="synopsis">Synopsis</h2> <pre class="cpp plain"> qt5_add_dbus_adaptor(<VAR> dbus_spec header parent_class [basename] [classname]) </pre> <a name="description"></a> <h2 id="description">Description</h2> <p>Generates a C++ header file implementing an adaptor for a D-Bus interface description file defined in <code>dbus_spec</code>. The path of the generated file is added to <code><VAR></code>. The generated adaptor class takes a pointer to <code>parent_class</code> as <a href="../qtcore/qobject.html">QObject</a> parent. <code>parent_class</code> should be declared in <code>header</code>, which is included in the generated code as <code>#include "header"</code>.</p> <p>The function sets up a call to the <a href="qdbusxml2cpp.html">Qt D-Bus XML compiler (qdbusxml2cpp)</a> in adaptor mode. The default file and class name are generated from the last segment in the <code>dbus_spec</code> base name:</p> <div class="table"><table class="generic"> <thead><tr class="qt-style"><th >XML file</th><th >Header file</th><th >Class name</th></tr></thead> <tr valign="top" class="odd"><td ><code>org.example.chat</code></td><td ><code>chatadaptor.h</code></td><td ><code>ChatAdaptor</code></td></tr> </table></div> <p>You can change the name of the header file to be generated by passing <code>basename</code> as the fifth argument. The <code>.h</code> suffix is always added.</p> <p>You can change the default class name by passing <code>classname</code> as the sixth argument.</p> <a name="examples"></a> <h2 id="examples">Examples</h2> <pre class="cpp"> qt5_add_dbus_adaptor(GENERATED_SOURCES org.example.chat.xml chat.h ChatMainWindow) </pre> </div> <!-- @@@qtdbus-cmake-qt5-add-dbus-adaptor.html --> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> 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.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>