Doc: Add \include snippets with optional parameters

There are many different wordings for how to use the module across the
module landing pages. The goal here is to provide consistent wording
and code formatting, which can be used across all landing pages.
The style and wording is based on what has been implemented in the
Qt CoAP module landing page.

This is the syntax in a qdoc file:
\include {module-use.qdoc} {<snippet-id>} {<argument1>}
Inside qdocinc, you can then get the value of the argument1 using the
parameter \1.

Task-number: QTBUG-100369
Change-Id: Ib25e509e119008157e69db629eb011e5a9074022
Pick-to: 6.3
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
Andreas Eliasson 2022-02-17 13:09:54 +01:00
parent 95603e09c9
commit 354e4e867a

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@ -41,6 +41,20 @@
//! [using qt module]
//! [using the c++ api]
Using a Qt module requires linking against the module library, either
directly or through other dependencies. Several build tools have dedicated
support for this, including \l{CMake Documentation}{CMake} and \l{qmake}.
//! [using the c++ api]
//! [using the qml api]
The QML types of the module are available through the \c \1 import. To use
the types, add the following import statement to your .qml file:
\qml
import \1
\endqml
//! [using the qml api]
//! [building with qmake]
@ -50,3 +64,24 @@
of the \c QT variable in the project's .pro file:
//! [building with qmake]
//! [building_with_qmake]
To configure the module for building with qmake, add the module as a value
of the \c QT variable in the project's .pro file:
\code
QT += \1
\endcode
//! [building_with_qmake]
//! [building with cmake]
Use the \c {find_package()} command to locate the needed module component
in the \c {Qt6} package:
\code
find_package(Qt6 REQUIRED COMPONENTS \1)
target_link_libraries(mytarget PRIVATE Qt6::\1)
\endcode
For more details, see the \l {Build with CMake} overview.
//! [building with cmake]