Protobuf Qt GUI Types Module
protobuf에서 네이티브 Qt GUI 유형을 사용할 수 있도록 지원합니다. 더 보기...
이 모듈은 Qt 6.6에서 도입되었습니다.
상세 설명
Qt::ProtobufQtGuiTypes는 선별된 Qt GUI 유형을 캡슐화하도록 설계된, 미리 정의된 Protobuf 메시지를 포함하는 라이브러리입니다.
지원되는 Qt GUI 유형 목록:
Qt GUI 사용법
Qt GUI 유형 지원을 활성화하려면 CMake 프로젝트에 ProtobufQtGuiTypes를 종속성으로 추가하십시오:
...
find_package(Qt REQUIRED COMPONENTS Protobuf ProtobufQtGuiTypes)
... # After target creation
target_link_libraries(${TARGET} PRIVATE Qt::ProtobufQtGuiTypes)Qt GUI 타입을 필드로 사용하는 메시지의 직렬화 또는 역직렬화를 수행하기 전에 등록 메서드를 호출하십시오:
// e.g. in main.cpp
QtProtobuf::qRegisterProtobufQtGuiTypes();
...지원되는 모든 메시지는 Qt GUI 모듈의 Qt 타입을 정의하는 특수한 .proto 파일인 QtGui.proto에 설명되어 있습니다.
이 파일을 사용하여 다른 언어나 프레임워크용 코드를 생성할 수도 있습니다.
인터페이스 .proto 파일에서 필요한 Qt GUI 타입 모듈을 임포트하십시오. 예를 들어:
syntax = "proto3";
package project.module.component;
import "QtGui/QtGui.proto";
message QMatrix4x4Message {
QtGui.QMatrix4x4 matrix = 1;
}Qt Protobuf 생성기는 ProtobufQtGuiTypes 패키지에서 제공하는 Qt GUI 타입을 감지하여 직접 사용합니다. 이를 통해 추가 변환 없이도 이러한 타입을 유연하게 사용할 수 있습니다.
CMake에서는 QT_PROTO_INCLUDES 타깃 속성을 사용하여 라이브러리에서 proto 포함 경로를 추출할 수 있습니다:
qt_add_protobuf(MyProtoLib
PROTO_FILES
MyQtGuiTypesUsage.proto
PROTO_INCLUDES
$<TARGET_PROPERTY:Qt::ProtobufQtGuiTypes,QT_PROTO_INCLUDES>
)QImage 직렬화
ProtobufQtGuiTypes 라이브러리는 QImage 클래스를 활용할 수 있는 기능을 제공합니다. 일반적으로 이 라이브러리는 모든 QImage 객체를 PNG 형식으로 변환합니다. 하지만 QImage 가 QImage::Format 의 부동 소수점 형식 중 하나로 생성된 경우, PNG 로 변환하면 데이터 손실이 발생합니다. 데이터 손실을 방지하기 위해, 라이브러리는 시스템에서 지원하는 경우 이미지 파일을 자동으로 TIFF 형식으로 변환하고, 그렇지 않은 경우 PNG 형식으로 변환합니다.
참고: TIFF 를 사용하지않으려면 , 이미지를 명시적으로 부동 소수점 형식이 아닌 형식으로 변환해야 합니다.
© 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.