aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-06-22 10:26:12 +0200
committerKai Koehne <kai.koehne@qt.io>2020-06-23 17:44:07 +0200
commit21dd7daa61a839bff6ff49ebb1ed23137542b1f4 (patch)
treefb4bcfd70706135091606ff418b618268bbd3b73 /src/qml/doc
parent3a95dd4df359750254eab4f46b69d1133b071b72 (diff)
Document how to use CMake for Qt Qml
Task-number: QTBUG-73058 Change-Id: Ic27cfdf76b8f77c9834baaeaf449434bf5f28416 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Diffstat (limited to 'src/qml/doc')
-rw-r--r--src/qml/doc/qtqml.qdocconf2
-rw-r--r--src/qml/doc/snippets/code/doc_src_qtqml.cmake4
-rw-r--r--src/qml/doc/snippets/code/doc_src_qtqml.cpp53
-rw-r--r--src/qml/doc/src/qtqml-cpp.qdoc12
-rw-r--r--src/qml/doc/src/qtqml.qdoc33
5 files changed, 25 insertions, 79 deletions
diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf
index 48d7f5a328..786a81846c 100644
--- a/src/qml/doc/qtqml.qdocconf
+++ b/src/qml/doc/qtqml.qdocconf
@@ -34,7 +34,7 @@ qhp.QtQml.subprojects.qmltypes.sortPages = true
tagfile = ../../../doc/qtqml/qtqml.tags
-depends += qtcore qtqmlmodels qtqmlworkerscript qtgui qtquick qtdoc qtlinguist qmake qtscript qtwidgets qtquickcontrols
+depends += qtcore qtqmlmodels qtqmlworkerscript qtgui qtquick qtdoc qtlinguist qtscript qtwidgets qtquickcontrols qmake qtcmake
headerdirs += .. \
../../qml
diff --git a/src/qml/doc/snippets/code/doc_src_qtqml.cmake b/src/qml/doc/snippets/code/doc_src_qtqml.cmake
new file mode 100644
index 0000000000..c824b24eb9
--- /dev/null
+++ b/src/qml/doc/snippets/code/doc_src_qtqml.cmake
@@ -0,0 +1,4 @@
+#! [0]
+find_package(Qt6 COMPONENTS Qml REQUIRED)
+target_link_libraries(mytarget Qt::Qml)
+#! [0]
diff --git a/src/qml/doc/snippets/code/doc_src_qtqml.cpp b/src/qml/doc/snippets/code/doc_src_qtqml.cpp
deleted file mode 100644
index 745e2f8f94..0000000000
--- a/src/qml/doc/snippets/code/doc_src_qtqml.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-#include <QtQml>
-//! [0]
diff --git a/src/qml/doc/src/qtqml-cpp.qdoc b/src/qml/doc/src/qtqml-cpp.qdoc
index 2c4d2a5ade..89c14cd82e 100644
--- a/src/qml/doc/src/qtqml-cpp.qdoc
+++ b/src/qml/doc/src/qtqml-cpp.qdoc
@@ -31,18 +31,6 @@
\qtvariable qml
\brief The C++ API provided by the Qt QML module.
-To include the definitions of the module's classes, use the
-following directive:
-
-\snippet code/doc_src_qtqml.cpp 0
-
-\if !defined(qtforpython)
-To link against the module, add this line to your \l qmake \c
-.pro file:
-
-\snippet code/doc_src_qtqml.pro 0
-\endif
-
For more information on the Qt QML module, see the
\l{Qt QML} module documentation.
*/
diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc
index 205cbc147d..5a1b59acdd 100644
--- a/src/qml/doc/src/qtqml.qdoc
+++ b/src/qml/doc/src/qtqml.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -46,14 +46,9 @@ For those new to QML and Qt Quick, please see
\l{QML Applications}
for an introduction to writing QML applications.
-\section1 Getting Started
+\section1 Using the Module
-To include the definitions of the module's classes, use the
-following directive:
-
-\code
-#include <QtQml>
-\endcode
+\section2 QML API
The QML types in Qt QML are available through the \c QtQml import. To use the
types, add the following import statement to your .qml file:
@@ -62,13 +57,25 @@ types, add the following import statement to your .qml file:
import QtQml 2.\1
\endqml
+\section2 C++ API
+
+Using the \l{Qt QML 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.
+
+\section3 Building with CMake
+
+Use the \c find_package() command to locate the needed module components in the Qt6 package:
+
+\snippet code/doc_src_qtqml.cmake 0
+
+See also the \l{Build with CMake} overview.
+
+\section3 Building with qmake
-To link against the module, add this line to your \l qmake \c
-.pro file:
+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 += qml
-\endcode
+\snippet code/doc_src_qtqml.pro 0
\section1 QML and QML Types