Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtdbus-cmake.qdoc
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\group cmake-commands-qtdbus
6\title CMake Commands in Qt6 DBus
7\brief Lists CMake commands defined in Qt6::DBus.
8
9The following CMake commands are defined when Qt6::DBus is loaded, for instance
10with
11
12\code
13find_package(Qt6 REQUIRED COMPONENTS DBus)
14\endcode
15
16\sa{CMake Command Reference}
17*/
18
19/*!
20\page qtdbus-cmake-qt-add-dbus-interface.html
21\ingroup cmake-commands-qtdbus
22
23\title qt_add_dbus_interface
24\keyword qt6_add_dbus_interface
25
26\summary {Generates C++ sources implementing an interface for a D-Bus interface
27description file.}
28
29\include cmake-find-package-dbus.qdocinc
30
31\cmakecommandsince 6.0
32
33\section1 Synopsis
34
35\badcode
36qt_add_dbus_interface(<VAR> dbus_spec basename)
37\endcode
38
39\versionlessCMakeCommandsNote qt6_add_dbus_interface()
40
41\section1 Description
42
43Generates C++ sources implementing an interface for a D-Bus interface description
44file defined in \c{dbus_spec}. The generated files are named after \c{basename}:
45\c{basename.h}, \c{basename.cpp}, \c{basename.moc}. The paths of the files
46are added to \c{<VAR>}.
47
48The function sets up a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
49in interface (proxy) mode. By default, \c{qdbusxml2cpp} generates a C++
50class named after the interface name, with a namespaced alias:
51
52\table
53\header
54 \li D-Bus Interface Name
55 \li Class name
56 \li Namespaced name
57\row
58 \li \c{org.example.chat}
59 \li \c{OrgExampleChatInterface}
60 \li \c{org.example.chat}
61\endtable
62
63\section1 Options
64
65Options can be set using \c set_source_files_properties on the \c dbus_spec:
66
67\table
68\header
69 \li Option
70 \li Value
71 \li Description
72\row
73 \li \c CLASSNAME
74 \li \c class_name
75 \li Override the default interface class name with \c{class_name}.
76\row
77 \li \c NO_NAMESPACE
78 \li boolean
79 \li Do not generate the namespaced name if set to \c{ON}.
80\row
81 \li \c INCLUDE
82 \li \c path
83 \li Add an \c{#include "path"} in the generated code.
84\endtable
85*/
86
87/*!
88\page qtdbus-cmake-qt-add-dbus-interfaces.html
89\ingroup cmake-commands-qtdbus
90
91\title qt_add_dbus_interfaces
92\keyword qt6_add_dbus_interfaces
93
94\summary {Generates C++ sources implementing interfaces for D-Bus interface
95description files.}
96
97\include cmake-find-package-dbus.qdocinc
98
99\cmakecommandsince 6.0
100
101\section1 Synopsis
102
103\badcode
104qt_add_dbus_interfaces(<VAR> dbus_spec1 [dbus_spec2 ...])
105\endcode
106
107\versionlessCMakeCommandsNote qt6_add_dbus_interfaces()
108
109\section1 Description
110
111Generates C++ sources implementing D-Bus interfaces defined in \c{dbus_spec1},
112\c{dbus_spec2}, where each argument needs to be the path to a valid D-Bus
113interface description file. The paths of the generated files are added to
114\c{<VAR>}.
115
116For each argument, a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
117in interface (proxy) mode is set up.
118
119The generated C++ source files are named after the XML file: For the file
120\c{org.example.chat.xml} the generated header will be named
121\c{orgexamplechatinterface.h}.
122
123\section1 Options
124
125Options can be set using \c set_source_files_properties on each of the file
126arguments:
127
128\table
129\header
130 \li Option
131 \li Value
132 \li Description
133\row
134 \li \c CLASSNAME
135 \li \c class_name
136 \li Override the default interface class name with \c{class_name}.
137\row
138 \li \c NO_NAMESPACE
139 \li boolean
140 \li Do not generate the namespaced name if set to \c{ON}.
141\row
142 \li \c INCLUDE
143 \li \c path
144 \li Add an \c{#include "path"} in the generated code.
145\endtable
146*/
147
148/*!
149\page qtdbus-cmake-qt-generate-dbus-interface.html
150\ingroup cmake-commands-qtdbus
151
152\title qt_generate_dbus_interface
153\keyword qt6_generate_dbus_interface
154
155\summary {Generates a D-Bus interface from a header file.}
156
157\include cmake-find-package-dbus.qdocinc
158
159\cmakecommandsince 6.0
160
161\section1 Synopsis
162
163\badcode
164qt_generate_dbus_interface(header
165 [customName]
166 [OPTIONS options]
167)
168\endcode
169
170\versionlessCMakeCommandsNote qt6_generate_dbus_interface()
171
172\section1 Description
173
174Parses the C++ source or header file containing a QObject-derived class
175declaration and generates a file containing the D-Bus Introspection XML.
176
177By default, the generated XML file is stored in the current binary directory,
178and has the same base name as the header. You can specify a different name or
179path by adding \c{customName} as an optional second argument.
180
181\section1 Options
182
183The function sets up a call to the \c{qdbuscpp2xml} command line tool. Further
184arguments to the tool can be set after \c{OPTIONS}.
185*/
186
187/*!
188\page qtdbus-cmake-qt-add-dbus-adaptor.html
189\ingroup cmake-commands-qtdbus
190
191\title qt_add_dbus_adaptor
192\keyword qt6_add_dbus_adaptor
193
194\summary {Generates an adaptor class for a D-Bus interface.}
195
196\include cmake-find-package-dbus.qdocinc
197
198\cmakecommandsince 6.0
199
200\section1 Synopsis
201
202\badcode
203qt_add_dbus_adaptor(<VAR> dbus_spec header
204 [parent_class]
205 [basename]
206 [classname]
207)
208\endcode
209
210\versionlessCMakeCommandsNote qt6_add_dbus_adaptor()
211
212\section1 Description
213
214Generates a C++ header file implementing an adaptor for a D-Bus interface
215description file defined in \c{dbus_spec}. The path of the generated file is
216added to \c{<VAR>}. The generated adaptor class takes a pointer to
217\c{parent_class} as QObject parent. \c{parent_class} should be declared in
218\c{header}, which is included in the generated code as \c{#include "header"}.
219
220The function sets up a call to the \l{Qt D-Bus XML compiler (qdbusxml2cpp)}
221in adaptor mode. The default file and class name are generated from the last
222segment in the \c{dbus_spec} base name:
223
224\table
225\header
226 \li XML file
227 \li Header file
228 \li Class name
229\row
230 \li \c{org.example.chat}
231 \li \c{chatadaptor.h}
232 \li \c{ChatAdaptor}
233\endtable
234
235
236You can change the name of the header file to be generated by passing
237\c{basename} as the fifth argument. The \c{.h} suffix is always added.
238
239You can change the default class name by passing \c{classname} as the sixth
240argument.
241
242\section1 Examples
243
244\snippet cmake/examples.cmake qt_add_dbus_adaptor
245*/
246
247/*!
248\group cmake-source-file-properties-qtdbus
249\title CMake Source File Properties in Qt6 DBus
250\brief Lists CMake file properties used in Qt6::DBus.
251
252\l{CMake Commands in Qt6 DBus}{CMake Commands} know about the following CMake
253source file properties:
254
255\sa{CMake Property Reference}
256*/
257
258/*!
259\page cmake-source-file-property-classname.html
260\ingroup cmake-source-file-properties-qtdbus
261
262\title CLASSNAME
263\target cmake-source-file-property-CLASSNAME
264
265\summary {Overrides the default interface class name.}
266
267\cmakepropertysince 5.0
268
269When this property is set, the generated C++ class name is overridden
270with the provided property value.
271
272\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}
273*/
274
275/*!
276\page cmake-source-file-property-include.html
277\ingroup cmake-source-file-properties-qtdbus
278
279\title INCLUDE
280\target cmake-source-file-property-INCLUDE
281
282\summary {Adds an include path.}
283
284\cmakepropertysince 5.0
285
286When this property is set, an #include "path" is added
287to the generated C++ file.
288
289\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}
290*/
291
292/*!
293\page cmake-source-file-property-no-namespace.html
294\ingroup cmake-source-file-properties-qtdbus
295
296\title NO_NAMESPACE
297\target cmake-source-file-property-NO_NAMESPACE
298
299\summary {Disables generation of a namespaced name.}
300
301\cmakepropertysince 5.0
302
303When this property is set, the generated C++ class will not contain a namespaced alias.
304
305\sa{qt6_add_dbus_interface}{qt_add_dbus_interface}
306*/
307