이 페이지에서

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.chatOrgExampleChatInterfaceorg.example.chat

옵션

옵션은 dbus_spec 에서 set_source_files_properties 를 사용하여 설정할 수 있습니다:

옵션값설명
CLASSNAMEclass_nameclass_name 를 사용하여 기본 인터페이스 클래스 이름을 재정의합니다.
NO_NAMESPACE부울ON 로 설정된 경우 네임스페이스 이름을 생성하지 않습니다.
INCLUDEpath생성된 코드에 #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.