diff options
author | Kai Koehne <kai.koehne@qt.io> | 2020-12-02 16:13:06 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-03 09:49:53 +0000 |
commit | 62a3193e90aa4961b2e702cd0035b173048524fc (patch) | |
tree | 9794efe897c08e152903d11b88749d4694acda82 /src/qmltest | |
parent | 8f99dcc57339c3299c38ea25625b548090d2dbc9 (diff) |
Document how to use CMake for Qt QuickTest
Task-number: QTBUG-73058
Change-Id: Ia00916e8ce8193225a773f85fe2af87e334afaab
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 3bf876a771c6e9e62b506f4c99965fca6d0e7f3b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qmltest')
-rw-r--r-- | src/qmltest/doc/qtqmltest.qdocconf | 2 | ||||
-rw-r--r-- | src/qmltest/doc/snippets/overview.cmake | 4 | ||||
-rw-r--r-- | src/qmltest/doc/src/qtquicktest-cppapi.qdoc | 17 | ||||
-rw-r--r-- | src/qmltest/doc/src/qtquicktest-index.qdoc | 46 |
4 files changed, 51 insertions, 18 deletions
diff --git a/src/qmltest/doc/qtqmltest.qdocconf b/src/qmltest/doc/qtqmltest.qdocconf index 25a7ae5f9b..a48e5fdef6 100644 --- a/src/qmltest/doc/qtqmltest.qdocconf +++ b/src/qmltest/doc/qtqmltest.qdocconf @@ -29,7 +29,7 @@ qhp.QtQmlTest.subprojects.qmltypes.sortPages = true tagfile = qtqmltest.tags -depends += qtcore qtgui qttestlib qtqml qtquick qtdoc +depends += qtcore qtgui qttestlib qtqml qtquick qtdoc qmake qtcmake headerdirs += .. diff --git a/src/qmltest/doc/snippets/overview.cmake b/src/qmltest/doc/snippets/overview.cmake new file mode 100644 index 0000000000..5415e42a17 --- /dev/null +++ b/src/qmltest/doc/snippets/overview.cmake @@ -0,0 +1,4 @@ +#! [cmake_use] +find_package(Qt6 COMPONENTS QuickTest REQUIRED) +target_link_libraries(mytarget PRIVATE Qt6::QuickTest) +#! [cmake_use] diff --git a/src/qmltest/doc/src/qtquicktest-cppapi.qdoc b/src/qmltest/doc/src/qtquicktest-cppapi.qdoc index 7dbdaae4a5..9f0b360a29 100644 --- a/src/qmltest/doc/src/qtquicktest-cppapi.qdoc +++ b/src/qmltest/doc/src/qtquicktest-cppapi.qdoc @@ -38,22 +38,5 @@ \snippet src_qmltest_qquicktest_snippet.cpp 0 - There are two ways to link against the corresponding C++ library. If your - test project uses a QML \l TestCase, you should already have the following - line in your project file: - - \badcode - CONFIG += qmltestcase - \endcode - - This will cause the test to link to the C++ \QtQuickTest library. - - If you have a C++-only test project, you can add the following line - to your project file: - - \badcode - QT += qmltest - \endcode - \sa {Executing C++ Before QML Tests} */ diff --git a/src/qmltest/doc/src/qtquicktest-index.qdoc b/src/qmltest/doc/src/qtquicktest-index.qdoc index 836030aedc..5a3fdfeef4 100644 --- a/src/qmltest/doc/src/qtquicktest-index.qdoc +++ b/src/qmltest/doc/src/qtquicktest-index.qdoc @@ -63,6 +63,52 @@ only guaranteed to work with the Qt version it was developed against. However, source compatibility is guaranteed. + \section1 Using the Module + + \section2 QML API + + The QML types in Qt Quick Test are available through the \c QtTest import. + To use the types, add the following import statement to your .qml file: + + \qml + import QtTest + \endqml + + \section2 C++ API + + Using the \l{Qt Quick Test C++ API}{C++ API} 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}. + + \section3 Building with CMake + + Use the \c find_package() command to locate the needed module components in + the Qt6 package: + + \snippet overview.cmake cmake_use + + See also the \l{Build with CMake} overview. + + \section3 Building with qmake + + There are two ways to link against the corresponding C++ library. If your + test project uses a QML \l TestCase, you should already have the following + line in your project file: + + \badcode + CONFIG += qmltestcase + \endcode + + This will cause the test to link to the C++ \QtQuickTest library. + + If you have a C++-only test project, you can add the following line + to your project file: + + \badcode + QT += qmltest + \endcode + \target Running Qt Quick Tests \section1 Running Tests |