Generates C++ sources implementing an interface for a D-Bus interface description file.
命令的定义在
DBus
组件对于
Qt6
package. Load the package with:
find_package(Qt6 REQUIRED COMPONENTS DBus)
该命令在 Qt 6.0 引入。
qt_add_dbus_interface(<VAR> dbus_spec basename)
若
无版本命令
被禁用,使用
qt6_add_dbus_interface()
代替。它支持如此命令的一组相同自变量。
Generates C++ sources implementing an interface for a D-Bus interface description file defined in
dbus_spec
. The generated files are named after
basename
:
basename.h
,
basename.cpp
,
basename.moc
. The paths of the files are added to
<VAR>
.
The function sets up a call to the
Qt D-Bus XML 编译器 (qdbusxml2cpp)
in interface (proxy) mode. By default,
qdbusxml2cpp
generates a C++ class named after the interface name, with a namespaced alias:
D-Bus Interface Name | Class name | Namespaced name |
---|---|---|
org.example.chat
|
OrgExampleChatInterface
|
org.example.chat
|
Options can be set using
set_source_files_properties
在
dbus_spec
:
选项 | 值 | 描述 |
---|---|---|
CLASSNAME
|
class_name
|
Override the default interface class name with
class_name
.
|
NO_NAMESPACE
|
boolean |
Do not generate the namespaced name if set to
ON
.
|
INCLUDE
|
path
|
Add an
#include "path"
in the generated code.
|