qt_add_dbus_adaptor
D-Bus 인터페이스용 어댑터 클래스를 생성합니다.
이 명령은 Qt6 패키지의 DBus 구성 요소에 정의되어 있습니다. 다음 명령을 사용하여 패키지를 불러오십시오:
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() 을 사용하십시오. 이 명령어는 본 명령어와 동일한 인자 집합을 지원합니다.
설명
dbus_spec 에 정의된 D-Bus 인터페이스 설명 파일에 대한 어댑터를 구현하는 C++ 헤더 파일을 생성합니다. 생성된 파일의 경로는 <VAR> 에 추가됩니다. 생성된 어댑터 클래스는 parent_class 에 대한 포인터를 QObject 부모로 받습니다. parent_class 는 header 에 선언되어야 하며, 이는 생성된 코드에 #include "header" 로 포함됩니다.
이 함수는 어댑터 모드에서 Qt D-Bus XML 컴파일러(qdbusxml2cpp) 호출을 설정합니다. 기본 파일명과 클래스명은 dbus_spec 의 기본 이름에서 마지막 부분을 가져와 생성됩니다:
| XML 파일 | 헤더 파일 | 클래스 이름 |
|---|---|---|
org.example.chat | chatadaptor.h | ChatAdaptor |
다섯 번째 인자로 basename 를 전달하여 생성될 헤더 파일의 이름을 변경할 수 있습니다. .h 접미사는 항상 추가됩니다.
여섯 번째 인수로 ` classname `를 전달하여 기본 클래스 이름을 변경할 수 있습니다.
예제
qt_add_dbus_adaptor(GENERATED_SOURCES org.example.chat.xml chat.h ChatMainWindow)© 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.