qt_add_dbus_adaptor

Generates an adaptor class for a D-Bus interface.

命令的定义在 DBus 组件对于 Qt6 package. Load the package with:

find_package(Qt6 REQUIRED COMPONENTS DBus)
					

该命令在 Qt 6.0 引入。

概要

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

无版本命令 被禁用,使用 qt6_add_dbus_adaptor() 代替。它支持如此命令的一组相同自变量。

描述

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 编译器 (qdbusxml2cpp) in adaptor mode. The default file and class name are generated from the last segment in the dbus_spec base name:

XML file Header file Class name
org.example.chat chatadaptor.h ChatAdaptor

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.

范例

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