Qt Protobuf Well-Known Types C++ Classes

Qt Protobuf Well-Known Types 模块为Well-Known Types包中的部分类型提供支持。更多

该模块在 Qt 6.6 中引入。

QtProtobuf::Any

用于简化 protobuf Any 类型操作的辅助类

详细描述

QtProtobufWellKnownTypes 包含以下Protobuf Well-Known 类型:支持的类型:

要在项目中使用知名类型,您可以在界面中包含相应的 google .proto 文件:

syntax = "proto3";
package somepackage;
import "google/protobuf/any.proto";
message Message {
    google.protobuf.Any payload = 1;
}

要使用列出的类型,您必须在CMakeLists.txt文件中添加以下一行,与QtProtobuf WellKnownTypes 库链接:

target_link_libraries(YourTargetName PRIVATE Qt::ProtobufWellKnownTypes)

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