Protobuf Qt GUI types module

Provides support for using native Qt Gui types in protobuf. More...

This module is in Technical Preview state.

This module was introduced in Qt 6.6.

Detailed Description

Qt::ProtobufQtGuiTypes is a library with pre-defined protobuf messages designed to encapsulate a selection of Qt Gui types.

List of supported Qt Gui types:

Qt GUI usage

To enable Qt GUI types support, add ProtobufQtGuiTypes as a dependency to your CMake project:

find_package(Qt REQUIRED COMPONENTS Protobuf ProtobufQtGuiTypes)
... # After target creation
target_link_libraries(${TARGET} PRIVATE Qt::ProtobufQtGuiTypes)

Before any serialization or deserialization of messages that use Qt GUI types as fields, call the registration method:

// e.g. in main.cpp

All supported messages are described in a special .proto file, QtGui.proto, that describes Qt types from the Qt GUI module.

You can also use the file to generate code for other languages or frameworks.

Import the required Qt GUI types module in your interface .proto file For example:

syntax = "proto3";

package project.module.component;

import "QtGui/QtGui.proto";

message QMatrix4x4Message {
    QtGui.QMatrix4x4 matrix = 1;

The QtProtobuf generator detects Qt GUI types, supplied by the ProtobufQtGuiTypes package, and uses them directly. This gives you the flexibility to use these types without additional conversion.

QImage serialization

The ProtobufQtGuiTypes library provides the possibility to work with the QImage class. Usually, the library converts all QImage objects in to PNG format. But if the QImage was created using a {floating point formats}, then conversion to PNG will lead to data loss. To prevent data loss, the library automatically converts the image file to TIFF format, if it is supported by the system, otherwise converts to PNG.

Note: if you don't want to use TIFF, you need to convert the image explicitly into a non-floating point format.

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