qt_add_dbus_adaptor

Synopsis

# added in Qt 5.15
qt_add_dbus_adaptor(<VAR> dbus_spec header
    [parent_class]
    [basename]
    [classname]
)

qt5_add_dbus_adaptor(<VAR> dbus_spec header
    [parent_class]
    [basename]
    [classname]
)

Description

Generates a C++ header file implementing an adaptor for a D-Bus interface description file defined in dbus_spec. The path of the generated file is added to <VAR>. The generated adaptor class takes a pointer to parent_class as QObject parent. parent_class should be declared in header, which is included in the generated code as #include "header".

The function sets up a call to the Qt D-Bus XML compiler (qdbusxml2cpp) in adaptor mode. The default file and class name are generated from the last segment in the dbus_spec base name:

XML fileHeader fileClass name
org.example.chatchatadaptor.hChatAdaptor

You can change the name of the header file to be generated by passing basename as the fifth argument. The .h suffix is always added.

You can change the default class name by passing classname as the sixth argument.

Examples

qt_add_dbus_adaptor(GENERATED_SOURCES org.example.chat.xml chat.h ChatMainWindow)

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. 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.