diff options
author | Craig Scott <craig.scott@qt.io> | 2021-06-02 16:54:21 +1000 |
---|---|---|
committer | Craig Scott <craig.scott@qt.io> | 2021-06-04 16:54:52 +1000 |
commit | 1c4ba17015fe99da48ce73fab75ecc60cf9cb975 (patch) | |
tree | 1311d8cebc4007d43888477045ca534404f2f7ca /src/qmlworkerscript | |
parent | 6432e00b954beec7d0c6bc9b70fed6191b87bd38 (diff) |
Refactor and update qml CMake API
The existing CMake API for qml modules had a number of
shortcomings. Refactor it to achieve the following:
- Clearly separate public and internal aspects.
- Re-use code from qtbase for adding plugins and module
targets rather than reimplementing close variations.
- Provide more robust and complete support for qmllint,
qmlcachegen and automatic generation of qmldir files.
- Reduce the steps needed for more common scenarios.
- Encourage the use of separate backing library and plugin
targets.
- Automatically generate the plugin class .cpp file where
possible.
- Specify .qml files directly through qml-specific API
elements rather than assuming they can be extracted
out of a set of resources.
[ChangeLog][QtQml] The qml CMake API has changed from 6.1
and is now out of Technical Preview status. The most
notable change is that .qml files should no longer be
specified as resources, there is dedicated handling for
them in the qt6_add_qml_module(). A related change is
that the qt6_target_qml_files() command has been replaced
by qt6_target_qml_sources(). More complete integration
with qmlcachegen, qmllint and qmldir generation is also
part of the CMake API.
Fixes: QTBUG-91621
Task-number: QTBUG-82598
Task-number: QTBUG-88763
Task-number: QTBUG-89274
Task-number: QTBUG-91444
Change-Id: I25aae1b0e89890394dfe2ba2824008164b2ca8d9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qmlworkerscript')
-rw-r--r-- | src/qmlworkerscript/CMakeLists.txt | 29 | ||||
-rw-r--r-- | src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf | 3 | ||||
-rw-r--r-- | src/qmlworkerscript/doc/src/qmlworkerscript.qdoc | 42 |
3 files changed, 49 insertions, 25 deletions
diff --git a/src/qmlworkerscript/CMakeLists.txt b/src/qmlworkerscript/CMakeLists.txt index 6716301b90..3525107cfe 100644 --- a/src/qmlworkerscript/CMakeLists.txt +++ b/src/qmlworkerscript/CMakeLists.txt @@ -1,10 +1,13 @@ -# Generated from qmlworkerscript.pro. - ##################################################################### ## QmlWorkerScript Module: ##################################################################### -qt_internal_add_module(QmlWorkerScript +qt_internal_add_qml_module(QmlWorkerScript + URI "QtQml.WorkerScript" + VERSION "${PROJECT_VERSION}" + DESIGNER_SUPPORTED + PLUGIN_TARGET workerscriptplugin + CLASS_NAME QtQmlWorkerScriptPlugin SOURCES qquickworkerscript.cpp qquickworkerscript_p.h qtqmlworkerscriptglobal.h qtqmlworkerscriptglobal_p.h @@ -47,15 +50,6 @@ qt_internal_add_module(QmlWorkerScript Qt::QmlPrivate ) -#### Keys ignored in scope 1:.:.:qmlworkerscript.pro:<TRUE>: -# QMLTYPES_FILENAME = "plugins.qmltypes" -# QMLTYPES_INSTALL_DIR = "$$[QT_INSTALL_QML]/QtQml/WorkerScript" -# QML_IMPORT_NAME = "QtQml.WorkerScript" -# QML_IMPORT_VERSION = "$$QT_VERSION" - -## Scopes: -##################################################################### - qt_internal_extend_target(QmlWorkerScript CONDITION WIN32 DEFINES NOMINMAX @@ -101,14 +95,3 @@ qt_internal_extend_target(QmlWorkerScript CONDITION GCC AND QT_COMPILER_VERSION_ qt_internal_add_docs(QmlWorkerScript doc/qtqmlworkerscript.qdocconf ) - - -set_target_properties(QmlWorkerScript PROPERTIES - QT_QML_MODULE_INSTALL_QMLTYPES TRUE - QT_QML_MODULE_VERSION ${PROJECT_VERSION} - QT_QML_MODULE_URI QtQml.WorkerScript - QT_QMLTYPES_FILENAME plugins.qmltypes - QT_QML_MODULE_INSTALL_DIR "${INSTALL_QMLDIR}/QtQml/WorkerScript" -) - -qt6_qml_type_registration(QmlWorkerScript) diff --git a/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf b/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf index e56e1759b3..303dee5261 100644 --- a/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf +++ b/src/qmlworkerscript/doc/qtqmlworkerscript.qdocconf @@ -27,8 +27,7 @@ depends += qtcore qtqml qtquick qtdoc headerdirs += .. -sourcedirs += .. \ - ../../imports/workerscript +sourcedirs += .. exampledirs += snippets diff --git a/src/qmlworkerscript/doc/src/qmlworkerscript.qdoc b/src/qmlworkerscript/doc/src/qmlworkerscript.qdoc new file mode 100644 index 0000000000..8f7f5e546c --- /dev/null +++ b/src/qmlworkerscript/doc/src/qmlworkerscript.qdoc @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** 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. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \qmlmodule QtQml.WorkerScript 2.\QtMinorVersion + \title Qt QML WorkerScript QML Types + \ingroup qmlmodules + \brief Provides QML types for worker scripts. + \since 5.14 + + This QML module contains types for using worker scripts. + + To use the types in this module, import the module with the following line: + + \qml + import QtQml.WorkerScript + \endqml +*/ |