[ProtobufQuick][GrpcQuick] add documentation examples for QML-argument

- qt-add-protobuf and qt-add-grpc APIs take "QML" as a parameter,
which requires ProtobufQuick and GrpcQuick supplied to find_package
call, but it's not mentioned in documentation.

Pick-to: 6.8 6.9
Task-number: QTBUG-131780
Change-Id: I26c24e0c2695587056e46782cb4bb36438c46313
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Tatiana Borisova 2025-01-09 16:10:42 +01:00
parent 6d28b38872
commit 82d92048db
3 changed files with 27 additions and 2 deletions

View File

@ -78,7 +78,25 @@ target to the protobuf one:
\list
\include qtprotoccommon.qdocinc proto_files-li
\include qtprotoccommon.qdocinc proto_includes-li
\include qtgrpcgen.qdocinc qml-li
\li \c {QML} generates the QML client API for the \gRPC service.
The argument requires the \c GrpcQuick Qt component.
\badcode
find_package(Qt6 6.8 REQUIRED COMPONENTS Quick Protobuf ProtobufQuick Grpc GrpcQuick)
...
# Generate the protobuf types
qt_add_protobuf(test_service_client
PROTO_FILES
test_service.protobuf
QML
)
...
# Generate \gRPC client functionality
qt_add_grpc(test_service_client CLIENT
PROTO_FILES
test_service.protobuf
QML
)
\endcode
\include qtprotoccommon.qdocinc output_directory-li
\include qtprotoccommon.qdocinc generate_package_subfolders-li
\include qtprotoccommon.qdocinc copy_comments-li

View File

@ -41,7 +41,7 @@ to the \c{MyMessages} library.
cmake_minimum_required(VERSION 3.16...3.22)
project(MyThings)
find_package(Qt6 REQUIRED COMPONENTS Protobuf Quick)
find_package(Qt6 REQUIRED COMPONENTS Protobuf ProtobufQuick Quick)
qt_standard_project_setup()
qt_add_protobuf(MyMessagesPlugin

View File

@ -46,6 +46,8 @@ link.
module, a new QML module will be created implicitly.
\badcode
find_package(Qt6 6.8 REQUIRED COMPONENTS Quick Protobuf ProtobufQuick)
...
qt_add_executable(target
...
)
@ -60,6 +62,8 @@ link.
attach the generated protobuf types to that module.
\badcode
find_package(Qt6 6.8 REQUIRED COMPONENTS Quick Protobuf ProtobufQuick)
...
qt_add_qml_module(target
...
)
@ -70,6 +74,9 @@ link.
)
\endcode
\note If you use QML argument, you have to add ProtobufQuick into
find_package call. See examples above.
\li \c {QML_URI}
defines the \c URI used for the QML module.