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)
© 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.