qt_add_dbus_interfaces
为 D-Bus 接口描述文件生成实现接口的 C++ 源。
该命令在Qt6
软件包的DBus
组件中定义。使用该命令加载软件包:
find_package(Qt6 REQUIRED COMPONENTS DBus)
该命令在 Qt 6.0 中引入。
简介
qt_add_dbus_interfaces(<VAR> dbus_spec1 [dbus_spec2 ...])
如果禁用了无版本命令,请使用qt6_add_dbus_interfaces()
代替。它支持与此命令相同的参数集。
说明
生成实现dbus_spec1
,dbus_spec2
中定义的 D-Bus 接口的 C++ 源文件,其中每个参数都必须是有效的 D-Bus 接口描述文件的路径。生成文件的路径会添加到<VAR>
中。
对于每个参数,都会在接口(代理)模式下调用Qt D-Bus XML 编译器 (qdbusxml2cpp)。
生成的 C++ 源文件以 XML 文件命名:对于org.example.chat.xml
文件,生成的头文件将命名为orgexamplechatinterface.h
。
选项
可在每个文件参数上使用set_source_files_properties
设置选项:
选项 | 值 | 说明 |
---|---|---|
CLASSNAME | class_name | 使用class_name 覆盖默认接口类名。 |
NO_NAMESPACE | 布尔 | 如果设置为ON ,则不生成命名名称。 |
INCLUDE | path | 在生成的代码中添加#include "path" 。 |
© 2025 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.