qt_add_dbus_interface
D-Busインターフェース記述ファイルのインターフェースを実装するC++ソースコードを生成します。
このコマンドは、Qt6 パッケージのDBus コンポーネントで定義されています。以下のコマンドでパッケージを読み込みます:
find_package(Qt6 REQUIRED COMPONENTS DBus)このコマンドは Qt 6.0 で導入されました。
概要
qt_add_dbus_interface(<VAR> dbus_spec basename)バージョン指定なしのコマンドが無効になっている場合は、代わりに `qt6_add_dbus_interface() ` を使用してください。このコマンドと同じ引数セットをサポートしています。
説明
dbus_spec で定義されたD-Busインターフェース記述ファイルのインターフェースを実装するC++ソースを生成します。生成されたファイル名は、basename に基づいて付けられます:basename.h 、basename.cpp 、basename.moc 。これらのファイルのパスは、<VAR> に追加されます。
この関数は、Qt D-Bus のXMLコンパイラ(qdbusxml2cpp)をインターフェース(プロキシ)モードで呼び出すように設定します。デフォルトでは、qdbusxml2cpp は、インターフェース名にちなんで名付けられたC++クラスを生成し、名前空間付きのエイリアスを次のように設定します:
| D-Bus インターフェース名 | クラス名 | 名前空間付き名 |
|---|---|---|
org.example.chat | OrgExampleChatInterface | org.example.chat |
オプション
オプションは、dbus_spec でset_source_files_properties を使用して設定できます:
| オプション | 値 | 説明 |
|---|---|---|
CLASSNAME | class_name | class_name を使用して、デフォルトのインターフェースクラス名を上書きします。 |
NO_NAMESPACE | boolean | ON に設定されている場合、名前空間付き名を生成しません。 |
INCLUDE | path | 生成されたコードに#include "path" を追加します。 |
© 2026 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.