From ecad9c74a137bb5de1ee84f98eccb6bd7a178781 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 22 Jun 2020 16:50:15 +0200 Subject: Document how to use CMake for Qt Quick Controls 2 Task-number: QTBUG-73058 Change-Id: Ib8f9dd5a1c44e1fc2487ca75226ed2ee8f7867d4 Reviewed-by: Paul Wicking Reviewed-by: Mitch Curtis --- src/imports/controls/doc/qtquickcontrols.qdocconf | 2 +- .../doc/snippets/qtquickcontrols2-overview.cmake | 4 +++ .../controls/doc/src/qtquickcontrols2-index.qdoc | 29 ++++++++++++++-------- 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 src/imports/controls/doc/snippets/qtquickcontrols2-overview.cmake (limited to 'src/imports/controls') diff --git a/src/imports/controls/doc/qtquickcontrols.qdocconf b/src/imports/controls/doc/qtquickcontrols.qdocconf index d52aceb8..604b4b7d 100644 --- a/src/imports/controls/doc/qtquickcontrols.qdocconf +++ b/src/imports/controls/doc/qtquickcontrols.qdocconf @@ -33,7 +33,7 @@ qhp.QtQuickControls.subprojects.examples.title = Examples qhp.QtQuickControls.subprojects.examples.indexTitle = Qt Quick Controls Examples qhp.QtQuickControls.subprojects.examples.selectors = fake:example -depends = qtcore qtgui qtdoc qtqml qtqmlmodels qtquick qtquickdialogs qtquickcontrols1 qtquickextras qmake qtsql qtwidgets qtlabscalendar qtlabsplatform qtgraphicaleffects +depends = qtcore qtgui qtdoc qtqml qtqmlmodels qtquick qtquickdialogs qtquickcontrols1 qtquickextras qtsql qtwidgets qtlabscalendar qtlabsplatform qtgraphicaleffects qmake qtcmake # Specify the install path under QT_INSTALL_EXAMPLES # Note: paths passed to \example command must contain the parent directory, e.g. diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-overview.cmake b/src/imports/controls/doc/snippets/qtquickcontrols2-overview.cmake new file mode 100644 index 00000000..2e9d2f3f --- /dev/null +++ b/src/imports/controls/doc/snippets/qtquickcontrols2-overview.cmake @@ -0,0 +1,4 @@ +#! [0] +find_package(Qt6 COMPONENTS QuickControls2 REQUIRED) +target_link_libraries(mytarget Qt::QuickControls2) +#! [0] diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc index fee009e6..c0047c30 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc @@ -41,7 +41,10 @@ Qt Quick Controls comes with a selection customizable styles. See \l {Styling Qt Quick Controls} for more details. - \section1 Prerequisites + + \section1 Using the Module + + \section2 QML API The \l{Qt Quick Controls QML Types}{QML types} can be imported into your application using the following import statement in your \c {.qml} file: @@ -50,22 +53,27 @@ import QtQuick.Controls 2.\1 \endqml - The \l{Qt Quick Controls C++ Classes}{C++ classes} can be included into - your application using the following include statement: + \section2 C++ API - \code - #include - \endcode + Using the \l{Qt Quick Controls C++ Classes}{C++ API} requires linking against the module library, + either directly or through other dependencies. + Several build tools have dedicated support for this, including CMake and qmake. - To link against the corresponding C++ libraries, add the following to your - qmake project file: + \section3 Building with CMake + Use the \c find_package() command to locate the needed module components in the Qt6 package: + + \snippet qtquickcontrols2-overview.cmake 0 + + See also the \l{Build with CMake} overview. + + \section3 Building with qmake + To configure the module for building with qmake, + add the module as a value of the QT variable in the project's .pro file: \code QT += quickcontrols2 \endcode - For more details, see \l {Getting Started with Qt Quick Controls}. - \section2 Building From Source When building from source, ensure that the \l {Qt Graphical Effects} module @@ -145,6 +153,7 @@ \section1 Topics \list + \li \l{Getting Started with Qt Quick Controls}{Getting Started} \li \l{Qt Quick Controls Guidelines}{Guidelines} \li \l{Styling Qt Quick Controls}{Styling} \li \l{Icons in Qt Quick Controls}{Icons} -- cgit v1.2.3