diff options
author | Kai Koehne <kai.koehne@qt.io> | 2020-06-22 16:50:15 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@qt.io> | 2020-06-25 08:12:01 +0200 |
commit | ecad9c74a137bb5de1ee84f98eccb6bd7a178781 (patch) | |
tree | 9641685bac3d1f68c93418754d80954da1d56b25 /src/imports | |
parent | 969a724352dfe3250efb871c70f9482d7b780165 (diff) |
Document how to use CMake for Qt Quick Controls 2
Task-number: QTBUG-73058
Change-Id: Ib8f9dd5a1c44e1fc2487ca75226ed2ee8f7867d4
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports')
3 files changed, 24 insertions, 11 deletions
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 <QtQuickControls2> - \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} |