diff options
Diffstat (limited to 'src/imports')
55 files changed, 62 insertions, 5521 deletions
diff --git a/src/imports/.prev_CMakeLists.txt b/src/imports/.prev_CMakeLists.txt deleted file mode 100644 index 468d7fc639..0000000000 --- a/src/imports/.prev_CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# Generated from imports.pro. - -add_subdirectory(builtins) -add_subdirectory(qtqml) -add_subdirectory(models) -add_subdirectory(labsmodels) -add_subdirectory(tooling) -if(QT_FEATURE_qml_itemmodel) - add_subdirectory(folderlistmodel) -endif() -if(QT_FEATURE_qml_worker_script) - add_subdirectory(workerscript) -endif() -if(TARGET Qt::Sql) - add_subdirectory(localstorage) -endif() -if(QT_FEATURE_settings) - add_subdirectory(settings) -endif() -if(TARGET Qt::Quick) - add_subdirectory(labsanimation) - add_subdirectory(layouts) - add_subdirectory(qtquick2) -endif() -if(QT_FEATURE_quick_shadereffect AND TARGET Qt::Quick) - add_subdirectory(wavefrontmesh) -endif() -if(TARGET Qt::Quick AND TARGET Qt::Test) - add_subdirectory(testlib) -endif() -if(QT_FEATURE_systemsemaphore AND TARGET Qt::Quick) - add_subdirectory(sharedimage) -endif() -if(QT_FEATURE_quick_particles AND TARGET Qt::Quick) - add_subdirectory(particles) -endif() -if(QT_FEATURE_quick_path AND TARGET Qt::Quick) - add_subdirectory(shapes) -endif() diff --git a/src/imports/CMakeLists.txt b/src/imports/CMakeLists.txt index 79a6a86016..e07c5b955d 100644 --- a/src/imports/CMakeLists.txt +++ b/src/imports/CMakeLists.txt @@ -1,42 +1 @@ -# Generated from imports.pro. - -add_subdirectory(builtins) -add_subdirectory(qtqml) -add_subdirectory(models) -add_subdirectory(labsmodels) add_subdirectory(tooling) -if(QT_FEATURE_qml_itemmodel) - add_subdirectory(folderlistmodel) -endif() -if(QT_FEATURE_qml_worker_script) - add_subdirectory(workerscript) -endif() -if(TARGET Qt::Sql) - add_subdirectory(localstorage) -endif() -if(QT_FEATURE_settings) - add_subdirectory(settings) -endif() -if(TARGET Qt::Quick) - add_subdirectory(labsanimation) - add_subdirectory(layouts) - add_subdirectory(qtquick2) -endif() -if(QT_FEATURE_quick_shadereffect AND TARGET Qt::Quick) - add_subdirectory(wavefrontmesh) -endif() -if(TARGET Qt::Quick AND TARGET Qt::Test) - add_subdirectory(testlib) -endif() -if(QT_FEATURE_systemsemaphore AND TARGET Qt::Quick) - add_subdirectory(sharedimage) -endif() -if(QT_FEATURE_quick_particles AND TARGET Qt::Quick) - add_subdirectory(particles) -endif() -if(QT_FEATURE_quick_path AND TARGET Qt::Quick) - add_subdirectory(shapes) -endif() -# special case begin -add_subdirectory(window) -# special case end diff --git a/src/imports/builtins/.prev_CMakeLists.txt b/src/imports/builtins/.prev_CMakeLists.txt deleted file mode 100644 index 088b0b73f0..0000000000 --- a/src/imports/builtins/.prev_CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -# Generated from builtins.pro. - diff --git a/src/imports/builtins/CMakeLists.txt b/src/imports/builtins/CMakeLists.txt deleted file mode 100644 index 40f1948144..0000000000 --- a/src/imports/builtins/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Generated from builtins.pro. - -# special case begin - -set(qml_type_file builtins.qmltypes) - -qt_path_join(qml_install_dir "${QT_INSTALL_DIR}" "${INSTALL_QMLDIR}") -qt_copy_or_install(FILES ${qml_type_file} - DESTINATION ${qml_install_dir} -) - -# special case end diff --git a/src/imports/builtins/builtins.qmltypes b/src/imports/builtins/builtins.qmltypes deleted file mode 100644 index c234300701..0000000000 --- a/src/imports/builtins/builtins.qmltypes +++ /dev/null @@ -1,143 +0,0 @@ -import QtQuick.tooling 1.2 - -Module { - dependencies: [] - - Component { - name: "void" - accessSemantics: "none" - } - - Component { - name: "QVariant" - accessSemantics: "value" - exports: ["QML/var 1.0", "QML/variant 1.0"] - exportMetaObjectRevisions: [256, 256] - } - - Component { - name: "QJSValue" - accessSemantics: "value" - } - - Component { - // QQmlV4Function is the name for varargs. If such parameter is declared - // we can invoke the method with any number of QJSValue parameters. - // Access semantics are not "value" because the actual QQmlV4Function object - // is passed as a pointer. - name: "QQmlV4Function" - } - - Component { - name: "QObject" - accessSemantics: "reference" - exports: ["QML/QtObject 1.0"] - exportMetaObjectRevisions: [256] - - Method { - name: "toString" - type: "QString" - } - - Method { - name: "destroy" - } - - Method { - name: "destroy" - - Parameter { - name: "delay" - type: "int" - } - } - } - - Component { - name: "QQmlComponent" - accessSemantics: "reference" - prototype: "QObject" - exports: ["QML/Component 1.0"] - exportMetaObjectRevisions: [256] - - Enum { - name: "Status" - values: ["Null", "Ready", "Loading", "Error"] - } - - Property { - name: "status" - type: "Status" - isReadonly: true - } - - Signal { - name: "statusChanged" - - Parameter { - type: "QQmlComponent::Status" - } - - } - - Method { - name: "errorString" - type: "QString" - } - } - - Component { - name: "number" - accessSemantics: "value" - } - - Component { - name: "int" - prototype: "number" - exports: ["QML/int 1.0"] - exportMetaObjectRevisions: [256] - accessSemantics: "value" - } - - Component { - name: "float" - prototype: "number" - accessSemantics: "value" - } - - Component { - name: "double" - prototype: "number" - exports: ["QML/real 1.0"] - exportMetaObjectRevisions: [256] - accessSemantics: "value" - } - - Component { - name: "QString" - exports: ["QML/string 1.0"] - exportMetaObjectRevisions: [256] - accessSemantics: "value" - } - - Component { - name: "bool" - exports: ["QML/bool 1.0"] - exportMetaObjectRevisions: [256] - accessSemantics: "value" - } - - Component { - name: "QDateTime" - exports: ["QML/date 1.0"] - exportMetaObjectRevisions: [256] - accessSemantics: "value" - } - - Component { - name: "QUrl" - exports: ["QML/url 1.0"] - exportMetaObjectRevisions: [256] - accessSemantics: "value" - } -} diff --git a/src/imports/folderlistmodel/CMakeLists.txt b/src/imports/folderlistmodel/CMakeLists.txt deleted file mode 100644 index 85a43061f4..0000000000 --- a/src/imports/folderlistmodel/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from folderlistmodel.pro. - -##################################################################### -## qmlfolderlistmodelplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmlfolderlistmodelplugin - URI "Qt.labs.folderlistmodel" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QmlFolderListModelPlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::QmlPrivate - Qt::LabsFolderListModelPrivate -) - -#### Keys ignored in scope 1:.:.:folderlistmodel.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "Qt/labs/folderlistmodel" diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp deleted file mode 100644 index d50002b4c4..0000000000 --- a/src/imports/folderlistmodel/plugin.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> -#include <QtQml/private/qqmlmetatype_p.h> - -#include <QtLabsFolderListModel/private/qquickfolderlistmodelglobal_p.h> -#include <QtLabsFolderListModel/private/qquickfolderlistmodel_p.h> - -QT_BEGIN_NAMESPACE - -//![class decl] -class QmlFolderListModelPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) - -public: - QmlFolderListModelPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_Qt_labs_folderlistmodel; - Q_UNUSED(registration); - } - - void registerTypes(const char *) override - { - } -}; -//![class decl] - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/labsanimation/CMakeLists.txt b/src/imports/labsanimation/CMakeLists.txt deleted file mode 100644 index cdf50468ac..0000000000 --- a/src/imports/labsanimation/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from labsanimation.pro. - -##################################################################### -## labsanimationplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(labsanimationplugin - URI "Qt.labs.animation" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QtLabsAnimationPlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::QmlPrivate - Qt::QuickPrivate - Qt::LabsAnimationPrivate -) - -#### Keys ignored in scope 1:.:.:labsanimation.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "Qt/labs/animation" diff --git a/src/imports/labsanimation/plugin.cpp b/src/imports/labsanimation/plugin.cpp deleted file mode 100644 index 11367ab287..0000000000 --- a/src/imports/labsanimation/plugin.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <QtLabsAnimation/private/qqmlanimationglobal_p.h> - -QT_BEGIN_NAMESPACE - -/*! - \qmlmodule Qt.labs.animation 1.0 - \title Qt Quick experimental animation types - \ingroup qmlmodules - \brief Provides QML experimental types for animation - \since 5.14 - - This QML module contains experimental QML types related to animation. - - To use the types in this module, import the module with the following line: - - \code - import Qt.labs.animation - \endcode -*/ - -//![class decl] -class QtLabsAnimationPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) -public: - QtLabsAnimationPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_Qt_labs_animation; - Q_UNUSED(registration); - } -}; -//![class decl] - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/labsmodels/CMakeLists.txt b/src/imports/labsmodels/CMakeLists.txt deleted file mode 100644 index 0c59a15a20..0000000000 --- a/src/imports/labsmodels/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Generated from labsmodels.pro. - -##################################################################### -## labsmodelsplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(labsmodelsplugin - URI "Qt.labs.qmlmodels" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QtQmlLabsModelsPlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::QmlPrivate - Qt::LabsQmlModelsPrivate -) - -#### Keys ignored in scope 1:.:.:labsmodels.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "Qt/labs/qmlmodels" - -## Scopes: -##################################################################### diff --git a/src/imports/labsmodels/plugin.cpp b/src/imports/labsmodels/plugin.cpp deleted file mode 100644 index 4735fe3583..0000000000 --- a/src/imports/labsmodels/plugin.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <private/qqmlmodelsmodule_p.h> - -#include <QtLabsQmlModels/private/qqmlmodelsglobal_p.h> - -QT_BEGIN_NAMESPACE - -/*! - \qmlmodule Qt.labs.qmlmodels 1.0 - \title Qt QML Models experimental QML Types - \ingroup qmlmodules - \brief Provides QML experimental types for data models. - \since 5.12 - - This QML module contains experimental QML types related to data models. - - To use the types in this module, import the module with the following line: - - \code - import Qt.labs.qmlmodels - \endcode -*/ - -//![class decl] -class QtQmlLabsModelsPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) -public: - QtQmlLabsModelsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_Qt_labs_qmlmodels; - Q_UNUSED(registration); - } -}; -//![class decl] - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/layouts/CMakeLists.txt b/src/imports/layouts/CMakeLists.txt deleted file mode 100644 index 6cfb911ba9..0000000000 --- a/src/imports/layouts/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Generated from layouts.pro. - -##################################################################### -## qquicklayoutsplugin Plugin: -##################################################################### - - -qt_internal_add_qml_module(qquicklayoutsplugin - URI "QtQuick.Layouts" - VERSION "${CMAKE_PROJECT_VERSION}" - DESIGNER_SUPPORTED - CLASSNAME QtQuickLayoutsPlugin - SKIP_TYPE_REGISTRATION - DEPENDENCIES - QtQuick - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Gui - Qt::Qml - Qt::QuickLayoutsPrivate -) - - -#### Keys ignored in scope 1:.:.:layouts.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQuick/Layouts" diff --git a/src/imports/layouts/plugin.cpp b/src/imports/layouts/plugin.cpp deleted file mode 100644 index 7e0c4ef053..0000000000 --- a/src/imports/layouts/plugin.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Layouts module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQuickLayouts/private/qquicklayoutglobal_p.h> - -QT_BEGIN_NAMESPACE - -//![class decl] -class QtQuickLayoutsPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) -public: - QtQuickLayoutsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtQuick_Layouts; - Q_UNUSED(registration); - } -}; -//![class decl] - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/localstorage/CMakeLists.txt b/src/imports/localstorage/CMakeLists.txt deleted file mode 100644 index 9d7cd13fe0..0000000000 --- a/src/imports/localstorage/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from localstorage.pro. - -##################################################################### -## qmllocalstorageplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmllocalstorageplugin - URI "QtQuick.LocalStorage" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QQmlLocalStoragePlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::Qml - Qt::QmlLocalStoragePrivate -) - -#### Keys ignored in scope 1:.:.:localstorage.pro:<TRUE>: -# CXX_MODULE = "qml" -# OTHER_FILES = "localstorage.json" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQuick/LocalStorage" diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp deleted file mode 100644 index 766469e4f6..0000000000 --- a/src/imports/localstorage/plugin.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <QtQmlLocalStorage/private/qqmllocalstorageglobal_p.h> - -QT_BEGIN_NAMESPACE - -class QQmlLocalStoragePlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) - -public: - QQmlLocalStoragePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtQuick_LocalStorage; - Q_UNUSED(registration); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/models/.prev_CMakeLists.txt b/src/imports/models/.prev_CMakeLists.txt deleted file mode 100644 index 89d65a22dc..0000000000 --- a/src/imports/models/.prev_CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from models.pro. - -##################################################################### -## modelsplugin Plugin: -##################################################################### - -qt_add_qml_module(modelsplugin - URI "QtQml.Models" - VERSION "${CMAKE_PROJECT_VERSION}" - DESIGNER_SUPPORTED - CLASSNAME QtQmlModelsPlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::QmlModelsPrivate - Qt::QmlPrivate -) - -#### Keys ignored in scope 1:.:.:models.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQml/Models" diff --git a/src/imports/models/CMakeLists.txt b/src/imports/models/CMakeLists.txt deleted file mode 100644 index 4070ad365b..0000000000 --- a/src/imports/models/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from models.pro. - -##################################################################### -## modelsplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(modelsplugin - URI "QtQml.Models" - VERSION "${CMAKE_PROJECT_VERSION}" - DESIGNER_SUPPORTED - CLASSNAME QtQmlModelsPlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::QmlModelsPrivate - Qt::QmlPrivate -) - -#### Keys ignored in scope 1:.:.:models.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQml/Models" diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp deleted file mode 100644 index 288b64f014..0000000000 --- a/src/imports/models/plugin.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Research In Motion. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQmlModels/private/qtqmlmodelsglobal_p.h> -#include <QtQml/qqmlextensionplugin.h> - -QT_BEGIN_NAMESPACE - -/*! - \qmlmodule QtQml.Models 2.\QtMinorVersion - \title Qt QML Models QML Types - \ingroup qmlmodules - \brief Provides QML types for data models - \since 5.1 - - This QML module contains types for defining data models in QML. - - To use the types in this module, import the module with the following line: - - \qml - import QtQml.Models - \endqml - - \note QtQml.Models module started at version 2.1 to match the version - of the parent module, \l{Qt QML}. - - In addition, Qt.labs.qmlmodels provides experimental QML types for models. - To use these experimental types, import the module with the following line: - - \qml - import Qt.labs.qmlmodels - \endqml - - \section1 QML Types - \generatelist qmltypesbymodule QtQml.Models - - \section1 Experimental QML Types - \generatelist qmltypesbymodule Qt.labs.qmlmodels - - \noautolist -*/ - -//![class decl] -class QtQmlModelsPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) -public: - QtQmlModelsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtQml_Models; - Q_UNUSED(registration); - } -}; -//![class decl] - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/particles/CMakeLists.txt b/src/imports/particles/CMakeLists.txt deleted file mode 100644 index 7e754a2cee..0000000000 --- a/src/imports/particles/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Generated from particles.pro. - -##################################################################### -## particlesplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(particlesplugin - URI "QtQuick.Particles" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QtQuick2ParticlesPlugin - SKIP_TYPE_REGISTRATION - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Gui - Qt::QmlPrivate - Qt::QuickParticlesPrivate - Qt::QuickPrivate -) - -#### Keys ignored in scope 1:.:.:particles.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQuick/Particles" diff --git a/src/imports/particles/plugin.cpp b/src/imports/particles/plugin.cpp deleted file mode 100644 index 6629a660af..0000000000 --- a/src/imports/particles/plugin.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <private/qquickparticlesmodule_p.h> - -QT_BEGIN_NAMESPACE - -//![class decl] -class QtQuick2ParticlesPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) -public: - QtQuick2ParticlesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtQuick_Particles; - Q_UNUSED(registration); - } - - void registerTypes(const char *uri) override - { - Q_UNUSED(uri); - QQuickParticlesModule::defineModule(); - } -}; -//![class decl] - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/qtqml/.prev_CMakeLists.txt b/src/imports/qtqml/.prev_CMakeLists.txt deleted file mode 100644 index 99e76596ea..0000000000 --- a/src/imports/qtqml/.prev_CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Generated from qtqml.pro. - -set(module_dynamic_qml_imports - QtQml.Models/auto -) - -if (QT_FEATURE_qml_worker_script) - list(APPEND module_dynamic_qml_imports - QtQml.WorkerScript/auto - ) -endif() - -##################################################################### -## qmlplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmlplugin - URI "QtQml" - VERSION "${CMAKE_PROJECT_VERSION}" - DESIGNER_SUPPORTED - CLASSNAME QtQmlPlugin - SKIP_TYPE_REGISTRATION - IMPORTS ${module_dynamic_qml_imports} - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::QmlModelsPrivate - Qt::QmlPrivate -) - -#### Keys ignored in scope 1:.:.:qtqml.pro:<TRUE>: -# CXX_MODULE = "qml" -# DYNAMIC_QMLDIR = "module QtQml" "optional plugin qmlplugin" "classname QtQmlPlugin" "typeinfo plugins.qmltypes" "designersupported" "import QtQml.Models auto" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQml" - -## Scopes: -##################################################################### - -#### Keys ignored in scope 2:.:.:qtqml.pro:QT_FEATURE_qml_worker_script: -# DYNAMIC_QMLDIR = "import QtQml.WorkerScript auto" diff --git a/src/imports/qtqml/CMakeLists.txt b/src/imports/qtqml/CMakeLists.txt deleted file mode 100644 index 15e66fd53e..0000000000 --- a/src/imports/qtqml/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Generated from qtqml.pro. - -set(module_dynamic_qml_imports - QtQml.Models/auto -) - -if (QT_FEATURE_qml_worker_script) - list(APPEND module_dynamic_qml_imports - QtQml.WorkerScript/auto - ) -endif() - -##################################################################### -## qmlplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmlplugin - URI "QtQml" - VERSION "${CMAKE_PROJECT_VERSION}" - DESIGNER_SUPPORTED - CLASSNAME QtQmlPlugin - SKIP_TYPE_REGISTRATION - IMPORTS ${module_dynamic_qml_imports} - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::QmlModelsPrivate - Qt::QmlPrivate - Qt::CorePrivate # special case -) - -#### Keys ignored in scope 1:.:.:qtqml.pro:<TRUE>: -# CXX_MODULE = "qml" -# DYNAMIC_QMLDIR = "module QtQml" "optional plugin qmlplugin" "classname QtQmlPlugin" "typeinfo plugins.qmltypes" "designersupported" "import QtQml.Models auto" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQml" - -## Scopes: -##################################################################### - -#### Keys ignored in scope 2:.:.:qtqml.pro:QT_FEATURE_qml_worker_script: -# DYNAMIC_QMLDIR = "import QtQml.WorkerScript auto" diff --git a/src/imports/qtqml/plugin.cpp b/src/imports/qtqml/plugin.cpp deleted file mode 100644 index 31a40bbe4c..0000000000 --- a/src/imports/qtqml/plugin.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/private/qtqmlglobal_p.h> -#include <QtQml/qqmlextensionplugin.h> - -QT_BEGIN_NAMESPACE - -/*! - \qmlmodule QtQml 2.\QtMinorVersion - \title Qt QML Base Types - \ingroup qmlmodules - \brief Provides basic QML types - \since 5.0 - - This QML module contains basic QML types. - - To use the types in this module, import the module with the following line: - - \qml - import QtQml - \endqml -*/ - -//![class decl] -class QtQmlPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) -public: - QtQmlPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtQml; - Q_UNUSED(registration); - } -}; -//![class decl] - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/qtquick2/CMakeLists.txt b/src/imports/qtquick2/CMakeLists.txt deleted file mode 100644 index e7e29bf9ae..0000000000 --- a/src/imports/qtquick2/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Generated from qtquick2.pro. - -##################################################################### -## qtquick2plugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qtquick2plugin - URI "QtQuick" - VERSION "${CMAKE_PROJECT_VERSION}" - DESIGNER_SUPPORTED - CLASSNAME QtQuick2Plugin - SKIP_TYPE_REGISTRATION - IMPORTS - QtQml/auto - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Gui - Qt::QmlModelsPrivate - Qt::QmlPrivate - Qt::QuickPrivate -) - -#### Keys ignored in scope 1:.:.:qtquick2.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQuick" - -## Scopes: -##################################################################### - -qt_internal_extend_target(qtquick2plugin CONDITION QT_FEATURE_qml_worker_script - PUBLIC_LIBRARIES - Qt::QmlWorkerScriptPrivate -) diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp deleted file mode 100644 index 8ab49c882e..0000000000 --- a/src/imports/qtquick2/plugin.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <private/qtquickglobal_p.h> - -QT_BEGIN_NAMESPACE - -class QtQuick2Plugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) -public: - QtQuick2Plugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtQuick; - volatile auto initialization = &QQuick_initializeModule; - Q_UNUSED(registration); - Q_UNUSED(initialization); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/settings/CMakeLists.txt b/src/imports/settings/CMakeLists.txt deleted file mode 100644 index f49e741106..0000000000 --- a/src/imports/settings/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from settings.pro. - -##################################################################### -## qmlsettingsplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmlsettingsplugin - URI "Qt.labs.settings" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QmlSettingsPlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Qml - Qt::LabsSettingsPrivate -) - -#### Keys ignored in scope 1:.:.:settings.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "Qt/labs/settings" diff --git a/src/imports/settings/plugin.cpp b/src/imports/settings/plugin.cpp deleted file mode 100644 index 428bd27198..0000000000 --- a/src/imports/settings/plugin.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <QtLabsSettings/private/qqmlsettingsglobal_p.h> - -QT_BEGIN_NAMESPACE - -class QmlSettingsPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) - -public: - QmlSettingsPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_Qt_labs_settings; - Q_UNUSED(registration); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/shapes/CMakeLists.txt b/src/imports/shapes/CMakeLists.txt deleted file mode 100644 index fa1eb9297c..0000000000 --- a/src/imports/shapes/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# Generated from shapes.pro. - -##################################################################### -## qmlshapesplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmlshapesplugin - URI "QtQuick.Shapes" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QmlShapesPlugin - SKIP_TYPE_REGISTRATION - DEPENDENCIES - QtQuick - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::GuiPrivate - Qt::Qml - Qt::QuickPrivate - Qt::QuickShapesPrivate -) - -#### Keys ignored in scope 1:.:.:shapes.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQuick/Shapes" diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp deleted file mode 100644 index 9a7f5dc77f..0000000000 --- a/src/imports/shapes/plugin.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> -#include <QtQuickShapes/private/qquickshape_p.h> - -QT_BEGIN_NAMESPACE - -class QmlShapesPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) - -public: - QmlShapesPlugin(QObject *parent = nullptr) - : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtQuick_Shapes; - volatile auto initialize = &QQuickShapes_initializeModule; - Q_UNUSED(registration); - Q_UNUSED(initialize); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/sharedimage/CMakeLists.txt b/src/imports/sharedimage/CMakeLists.txt deleted file mode 100644 index b0faea295f..0000000000 --- a/src/imports/sharedimage/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Generated from sharedimage.pro. - -##################################################################### -## sharedimageplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(sharedimageplugin - URI "Qt.labs.sharedimage" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QtQuickSharedImagePlugin - SKIP_TYPE_REGISTRATION - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Qml - Qt::LabsSharedImagePrivate -) - -#### Keys ignored in scope 1:.:.:sharedimage.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "Qt/labs/sharedimage" diff --git a/src/imports/sharedimage/plugin.cpp b/src/imports/sharedimage/plugin.cpp deleted file mode 100644 index dab04efd92..0000000000 --- a/src/imports/sharedimage/plugin.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtLabsSharedImage/private/qtlabssharedimageglobal_p.h> -#include <QtLabsSharedImage/private/qsharedimageprovider_p.h> - -#include <qqmlextensionplugin.h> -#include <qqmlengine.h> - -/*! - \qmlmodule Qt.labs.sharedimage 1 - \title Qt Quick Shared Image Provider - \ingroup qmlmodules - \brief Adds an image provider which utilizes shared CPU memory - - \section2 Summary - - This module provides functionality to save memory in use cases where - several Qt Quick applications use the same local image files. It does this - by placing the decoded QImage data in shared system memory, making it - accessible to all the processes (see QSharedMemory). - - This module only shares CPU memory. It does not provide sharing of GPU - memory or textures. - - \section2 Usage - - To use this module, import it like this: - \code - import Qt.labs.sharedimage - \endcode - - The sharing functionality is provided through a QQuickImageProvider. Use - the "image:" scheme for the URL source of the image, followed by the - identifier \e shared, followed by the image file path. For example: - - \code - Image { source: "image://shared/usr/share/wallpapers/mybackground.jpg" } - \endcode - - This will look for the file \e /usr/share/wallpapers/mybackground.jpg. - The first process that does this will read the image file - using normal Qt image loading. The decoded image data will then be placed - in shared memory, using the full file path as key. Later processes - requesting the same image will discover that the data is already available - in shared memory. They will then use that instead of loading the image file - again. - - The shared image data will be kept available until the last process has deleted - its last reference to the shared image, at which point it is automatically released. - - If system memory sharing is not available, the shared image provider falls - back to normal, unshared image loading. - - The file path must be absolute. To use a relative path, make it absolute - using \e Qt.resolvedUrl() and replace the URL scheme. For example: - - \code - ... - property string imagePrefix: Qt.resolvedUrl("../myimages/").replace("file://", "image://shared/") - Image { source: imagePrefix + "myimage.png" } - \endcode - - The shared image module does not provide any directly usable QML types. -*/ - -QT_BEGIN_NAMESPACE - -class QtQuickSharedImagePlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) -public: - QtQuickSharedImagePlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_Qt_labs_sharedimage; - Q_UNUSED(registration); - } - - void initializeEngine(QQmlEngine *engine, const char *uri) override - { - Q_UNUSED(uri); - engine->addImageProvider("shared", new SharedImageProvider); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/testlib/.prev_CMakeLists.txt b/src/imports/testlib/.prev_CMakeLists.txt deleted file mode 100644 index 787f163a84..0000000000 --- a/src/imports/testlib/.prev_CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# Generated from testlib.pro. - -##################################################################### -## qmltestplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmltestplugin - URI "QtTest" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QTestQmlModule - DEPENDENCIES - QtQuick.Window/2.0 - PLUGIN_OPTIONAL - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Qml - Qt::QuickTestPrivate -) - -#### Keys ignored in scope 1:.:.:testlib.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_FILES = "TestCase.qml" "SignalSpy.qml" "testlogger.js" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtTest" - -set(qml_files - "TestCase.qml" - "SignalSpy.qml" - "testlogger.js" -) -set_source_files_properties(TestCase.qml PROPERTIES - QT_QML_SOURCE_VERSION "1.0" -) -set_source_files_properties(SignalSpy.qml PROPERTIES - QT_QML_SOURCE_VERSION "1.0" -) -set_source_files_properties(testlogger.js PROPERTIES - QT_QML_SKIP_QMLDIR_ENTRY TRUE -) - -qt6_target_qml_files(qmltestplugin - FILES - ${qml_files} -) diff --git a/src/imports/testlib/CMakeLists.txt b/src/imports/testlib/CMakeLists.txt deleted file mode 100644 index 1e199b947b..0000000000 --- a/src/imports/testlib/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# Generated from testlib.pro. - -##################################################################### -## qmltestplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmltestplugin - URI "QtTest" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QTestQmlModule - DEPENDENCIES - QtQuick.Window/2.0 - PLUGIN_OPTIONAL - SOURCES - main.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Gui - Qt::Qml - Qt::QuickTestPrivate -) - -#### Keys ignored in scope 1:.:.:testlib.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_FILES = "TestCase.qml" "SignalSpy.qml" "testlogger.js" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtTest" - -set(qml_files - "TestCase.qml" - "SignalSpy.qml" - "testlogger.js" -) -set_source_files_properties(TestCase.qml PROPERTIES - QT_QML_SOURCE_VERSION "1.0" -) -set_source_files_properties(SignalSpy.qml PROPERTIES - QT_QML_SOURCE_VERSION "1.0" -) -set_source_files_properties(testlogger.js PROPERTIES - QT_QML_SKIP_QMLDIR_ENTRY TRUE -) - -qt6_target_qml_files(qmltestplugin - FILES - ${qml_files} -) diff --git a/src/imports/testlib/SignalSpy.qml b/src/imports/testlib/SignalSpy.qml deleted file mode 100644 index 52ed83e261..0000000000 --- a/src/imports/testlib/SignalSpy.qml +++ /dev/null @@ -1,268 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtTest 1.1 - -/*! - \qmltype SignalSpy - \inqmlmodule QtTest - \brief Enables introspection of signal emission. - \since 4.8 - \ingroup qtquicktest - - In the following example, a SignalSpy is installed to watch the - "clicked" signal on a user-defined Button type. When the signal - is emitted, the \l count property on the spy will be increased. - - \code - Button { - id: button - SignalSpy { - id: spy - target: button - signalName: "clicked" - } - TestCase { - name: "ButtonClick" - function test_click() { - compare(spy.count, 0) - button.clicked(); - compare(spy.count, 1) - } - } - } - \endcode - - The above style of test is suitable for signals that are emitted - synchronously. For asynchronous signals, the wait() method can be - used to block the test until the signal occurs (or a timeout expires). - - \sa {QtTest::TestCase}{TestCase}, {Qt Quick Test} -*/ - -Item { - id: spy - visible: false - - TestUtil { - id: util - } - // Public API. - /*! - \qmlproperty object SignalSpy::target - - This property defines the target object that will be used to - listen for emissions of the \l signalName signal. - - \sa signalName, count - */ - property var target: null - /*! - \qmlproperty string SignalSpy::signalName - - This property defines the name of the signal on \l target to - listen for. - - \sa target, count - */ - property string signalName: "" - /*! - \qmlproperty int SignalSpy::count - - This property defines the number of times that \l signalName has - been emitted from \l target since the last call to clear(). - - \sa target, signalName, clear() - \readonly - */ - readonly property alias count: spy.qtest_count - /*! - \qmlproperty bool SignalSpy::valid - - This property defines the current signal connection status. It will be true when the \l signalName of the \l target is connected successfully, otherwise it will be false. - - \sa count, target, signalName, clear() - \readonly - */ - readonly property alias valid:spy.qtest_valid - /*! - \qmlproperty list SignalSpy::signalArguments - - This property holds a list of emitted signal arguments. Each emission of the signal will append one item to the list, containing the arguments of the signal. - When connecting to a new \l target or new \l signalName or calling the \l clear() method, the \l signalArguments will be reset to empty. - - \sa signalName, clear() - \readonly - */ - readonly property alias signalArguments:spy.qtest_signalArguments - - /*! - \qmlmethod SignalSpy::clear() - - Clears \l count to 0, resets \l valid to false and clears the \l signalArguments to empty. - - \sa count, wait() - */ - function clear() { - qtest_count = 0 - qtest_expectedCount = 0 - qtest_signalArguments = [] - } - - /*! - \qmlmethod SignalSpy::wait(timeout = 5000) - - Waits for the signal \l signalName on \l target to be emitted, - for up to \a timeout milliseconds. The test case will fail if - the signal is not emitted. - - \code - SignalSpy { - id: spy - target: button - signalName: "clicked" - } - - function test_async_click() { - ... - // do something that will cause clicked() to be emitted - ... - spy.wait() - compare(spy.count, 1) - } - \endcode - - There are two possible scenarios: the signal has already been - emitted when wait() is called, or the signal has not yet been - emitted. The wait() function handles the first scenario by immediately - returning if the signal has already occurred. - - The clear() method can be used to discard information about signals - that have already occurred to synchronize wait() with future signal - emissions. - - \sa clear(), TestCase::tryCompare() - */ - function wait(timeout) { - if (timeout === undefined) - timeout = 5000 - var expected = ++qtest_expectedCount - var i = 0 - while (i < timeout && qtest_count < expected) { - qtest_results.wait(50) - i += 50 - } - var success = (qtest_count >= expected) - if (!qtest_results.verify(success, "wait for signal " + signalName, util.callerFile(), util.callerLine())) - throw new Error("QtQuickTest::fail") - } - - // Internal implementation detail follows. - - TestResult { id: qtest_results } - - onTargetChanged: { - qtest_update() - } - onSignalNameChanged: { - qtest_update() - } - - /*! \internal */ - property var qtest_prevTarget: null - /*! \internal */ - property string qtest_prevSignalName: "" - /*! \internal */ - property int qtest_expectedCount: 0 - /*! \internal */ - property var qtest_signalArguments:[] - /*! \internal */ - property int qtest_count: 0 - /*! \internal */ - property bool qtest_valid:false - /*! \internal */ - - /*! \internal */ - function qtest_update() { - if (qtest_prevTarget != null) { - var prevHandlerName = qtest_signalHandlerName(qtest_prevSignalName) - var prevFunc = qtest_prevTarget[prevHandlerName] - if (prevFunc) - prevFunc.disconnect(spy.qtest_activated) - qtest_prevTarget = null - qtest_prevSignalName = "" - } - if (target != null && signalName != "") { - // Look for the signal name in the object - var func = target[signalName] - if (typeof func !== "function") { - // If it is not a function, try looking for signal handler - // i.e. (onSignal) this is needed for cases where there is a property - // and a signal with the same name, e.g. Mousearea.pressed - func = target[qtest_signalHandlerName(signalName)] - } - if (func === undefined) { - spy.qtest_valid = false - console.log("Signal '" + signalName + "' not found") - } else { - qtest_prevTarget = target - qtest_prevSignalName = signalName - func.connect(spy.qtest_activated) - spy.qtest_valid = true - spy.qtest_signalArguments = [] - } - } else { - spy.qtest_valid = false - } - } - - /*! \internal */ - function qtest_activated() { - ++qtest_count - spy.qtest_signalArguments[spy.qtest_signalArguments.length] = arguments - } - - /*! \internal */ - function qtest_signalHandlerName(sn) { - if (sn.substr(0, 2) === "on" && sn[2] === sn[2].toUpperCase()) - return sn - return "on" + sn.substr(0, 1).toUpperCase() + sn.substr(1) - } -} diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml deleted file mode 100644 index 1c9011e01e..0000000000 --- a/src/imports/testlib/TestCase.qml +++ /dev/null @@ -1,2016 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Window 2.0 // used for qtest_verifyItem -import QtTest 1.2 -import "testlogger.js" as TestLogger - -/*! - \qmltype TestCase - \inqmlmodule QtTest - \brief Represents a unit test case. - \since 4.8 - \ingroup qtquicktest - - \section1 Introduction to QML Test Cases - - Test cases are written as JavaScript functions within a TestCase - type: - - \code - import QtQuick 2.0 - import QtTest 1.2 - - TestCase { - name: "MathTests" - - function test_math() { - compare(2 + 2, 4, "2 + 2 = 4") - } - - function test_fail() { - compare(2 + 2, 5, "2 + 2 = 5") - } - } - \endcode - - Functions whose names start with "test_" are treated as test cases - to be executed. The \l name property is used to prefix the functions - in the output: - - \code - ********* Start testing of MathTests ********* - Config: Using QTest library 4.7.2, Qt 4.7.2 - PASS : MathTests::initTestCase() - FAIL! : MathTests::test_fail() 2 + 2 = 5 - Actual (): 4 - Expected (): 5 - Loc: [/home/.../tst_math.qml(12)] - PASS : MathTests::test_math() - PASS : MathTests::cleanupTestCase() - Totals: 3 passed, 1 failed, 0 skipped - ********* Finished testing of MathTests ********* - \endcode - - Because of the way JavaScript properties work, the order in which the - test functions are found is unpredictable. To assist with predictability, - the test framework will sort the functions on ascending order of name. - This can help when there are two tests that must be run in order. - - Multiple TestCase types can be supplied. The test program will exit - once they have all completed. If a test case doesn't need to run - (because a precondition has failed), then \l optional can be set to true. - - \section1 Data-driven Tests - - Table data can be provided to a test using a function name that ends - with "_data". Alternatively, the \c init_data() function can be used - to provide default test data for all test functions in a TestCase type: - - - \code - import QtQuick 2.0 - import QtTest 1.2 - - TestCase { - name: "DataTests" - - function init_data() { - return [ - {tag:"init_data_1", a:1, b:2, answer: 3}, - {tag:"init_data_2", a:2, b:4, answer: 6} - ]; - } - - function test_table_data() { - return [ - {tag: "2 + 2 = 4", a: 2, b: 2, answer: 4 }, - {tag: "2 + 6 = 8", a: 2, b: 6, answer: 8 }, - ] - } - - function test_table(data) { - //data comes from test_table_data - compare(data.a + data.b, data.answer) - } - - function test__default_table(data) { - //data comes from init_data - compare(data.a + data.b, data.answer) - } - } - \endcode - - The test framework will iterate over all of the rows in the table - and pass each row to the test function. As shown, the columns can be - extracted for use in the test. The \c tag column is special - it is - printed by the test framework when a row fails, to help the reader - identify which case failed amongst a set of otherwise passing tests. - - \section1 Benchmarks - - Functions whose names start with "benchmark_" will be run multiple - times with the Qt benchmark framework, with an average timing value - reported for the runs. This is equivalent to using the \c{QBENCHMARK} - macro in the C++ version of QTestLib. - - \code - TestCase { - id: top - name: "CreateBenchmark" - - function benchmark_create_component() { - var component = Qt.createComponent("item.qml") - var obj = component.createObject(top) - obj.destroy() - component.destroy() - } - } - - RESULT : CreateBenchmark::benchmark_create_component: - 0.23 msecs per iteration (total: 60, iterations: 256) - PASS : CreateBenchmark::benchmark_create_component() - \endcode - - To get the effect of the \c{QBENCHMARK_ONCE} macro, prefix the test - function name with "benchmark_once_". - - \section1 Simulating Keyboard and Mouse Events - - The keyPress(), keyRelease(), and keyClick() methods can be used - to simulate keyboard events within unit tests. The events are - delivered to the currently focused QML item. You can pass either - a Qt.Key enum value or a latin1 char (string of length one) - - \code - Rectangle { - width: 50; height: 50 - focus: true - - TestCase { - name: "KeyClick" - when: windowShown - - function test_key_click() { - keyClick(Qt.Key_Left) - keyClick("a") - ... - } - } - } - \endcode - - The mousePress(), mouseRelease(), mouseClick(), mouseDoubleClickSequence() - and mouseMove() methods can be used to simulate mouse events in a - similar fashion. - - \b{Note:} keyboard and mouse events can only be delivered once the - main window has been shown. Attempts to deliver events before then - will fail. Use the \l when and windowShown properties to track - when the main window has been shown. - - \section1 Managing Dynamically Created Test Objects - - A typical pattern with QML tests is to - \l {Dynamic QML Object Creation from JavaScript}{dynamically create} - an item and then destroy it at the end of the test function: - - \code - TestCase { - id: testCase - name: "MyTest" - when: windowShown - - function test_click() { - var item = Qt.createQmlObject("import QtQuick 2.0; Item {}", testCase); - verify(item); - - // Test item... - - item.destroy(); - } - } - \endcode - - The problem with this pattern is that any failures in the test function - will cause the call to \c item.destroy() to be skipped, leaving the item - hanging around in the scene until the test case has finished. This can - result in interference with future tests; for example, by blocking input - events or producing unrelated debug output that makes it difficult to - follow the code's execution. - - By calling \l createTemporaryQmlObject() instead, the object is guaranteed - to be destroyed at the end of the test function: - - \code - TestCase { - id: testCase - name: "MyTest" - when: windowShown - - function test_click() { - var item = createTemporaryQmlObject("import QtQuick 2.0; Item {}", testCase); - verify(item); - - // Test item... - - // Don't need to worry about destroying "item" here. - } - } - \endcode - - For objects that are created via the \l {Component::}{createObject()} function - of \l Component, the \l createTemporaryObject() function can be used. - - \sa {QtTest::SignalSpy}{SignalSpy}, {Qt Quick Test} -*/ - - -Item { - id: testCase - visible: false - TestUtil { - id:util - } - - /*! - \qmlproperty string TestCase::name - - This property defines the name of the test case for result reporting. - The default value is an empty string. - - \code - TestCase { - name: "ButtonTests" - ... - } - \endcode - */ - property string name - - /*! - \qmlproperty bool TestCase::when - - This property should be set to true when the application wants - the test cases to run. The default value is true. In the following - example, a test is run when the user presses the mouse button: - - \code - Rectangle { - id: foo - width: 640; height: 480 - color: "cyan" - - MouseArea { - id: area - anchors.fill: parent - } - - property bool bar: true - - TestCase { - name: "ItemTests" - when: area.pressed - id: test1 - - function test_bar() { - verify(bar) - } - } - } - \endcode - - The test application will exit once all \l TestCase types - have been triggered and have run. The \l optional property can - be used to exclude a \l TestCase type. - - \sa optional, completed - */ - property bool when: true - - /*! - \qmlproperty bool TestCase::completed - - This property will be set to true once the test case has completed - execution. Test cases are only executed once. The initial value - is false. - - \sa running, when - */ - property bool completed: false - - /*! - \qmlproperty bool TestCase::running - - This property will be set to true while the test case is running. - The initial value is false, and the value will become false again - once the test case completes. - - \sa completed, when - */ - property bool running: false - - /*! - \qmlproperty bool TestCase::optional - - Multiple \l TestCase types can be supplied in a test application. - The application will exit once they have all completed. If a test case - does not need to run (because a precondition has failed), then this - property can be set to true. The default value is false. - - \code - TestCase { - when: false - optional: true - function test_not_run() { - verify(false) - } - } - \endcode - - \sa when, completed - */ - property bool optional: false - - /*! - \qmlproperty bool TestCase::windowShown - - This property will be set to true after the QML viewing window has - been displayed. Normally test cases run as soon as the test application - is loaded and before a window is displayed. If the test case involves - visual types and behaviors, then it may need to be delayed until - after the window is shown. - - \code - Button { - id: button - onClicked: text = "Clicked" - TestCase { - name: "ClickTest" - when: windowShown - function test_click() { - button.clicked(); - compare(button.text, "Clicked"); - } - } - } - \endcode - */ - property bool windowShown: QTestRootObject.windowShown - - // Internal private state. Identifiers prefixed with qtest are reserved. - /*! \internal */ - property bool qtest_prevWhen: true - /*! \internal */ - property int qtest_testId: -1 - /*! \internal */ - property bool qtest_componentCompleted : false - /*! \internal */ - property var qtest_testCaseResult - /*! \internal */ - property var qtest_results: qtest_results_normal - /*! \internal */ - TestResult { id: qtest_results_normal } - /*! \internal */ - property var qtest_events: qtest_events_normal - TestEvent { id: qtest_events_normal } - /*! \internal */ - property var qtest_temporaryObjects: [] - - /*! - \qmlmethod TestCase::fail(message = "") - - Fails the current test case, with the optional \a message. - Similar to \c{QFAIL(message)} in C++. - */ - function fail(msg) { - if (msg === undefined) - msg = ""; - qtest_results.fail(msg, util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - - /*! \internal */ - function qtest_fail(msg, frame) { - if (msg === undefined) - msg = ""; - qtest_results.fail(msg, util.callerFile(frame), util.callerLine(frame)) - throw new Error("QtQuickTest::fail") - } - - /*! - \qmlmethod TestCase::verify(condition, message = "") - - Fails the current test case if \a condition is false, and - displays the optional \a message. Similar to \c{QVERIFY(condition)} - or \c{QVERIFY2(condition, message)} in C++. - */ - function verify(cond, msg) { - if (arguments.length > 2) - qtest_fail("More than two arguments given to verify(). Did you mean tryVerify() or tryCompare()?", 1) - - if (msg === undefined) - msg = ""; - if (!qtest_results.verify(cond, msg, util.callerFile(), util.callerLine())) - throw new Error("QtQuickTest::fail") - } - - /*! - \since 5.8 - \qmlmethod TestCase::tryVerify(function, timeout = 5000, message = "") - - Fails the current test case if \a function does not evaluate to - \c true before the specified \a timeout (in milliseconds) has elapsed. - The function is evaluated multiple times until the timeout is - reached. An optional \a message is displayed upon failure. - - This function is intended for testing applications where a condition - changes based on asynchronous events. Use verify() for testing - synchronous condition changes, and tryCompare() for testing - asynchronous property changes. - - For example, in the code below, it's not possible to use tryCompare(), - because the \c currentItem property might be \c null for a short period - of time: - - \code - tryCompare(listView.currentItem, "text", "Hello"); - \endcode - - Instead, we can use tryVerify() to first check that \c currentItem - isn't \c null, and then use a regular compare afterwards: - - \code - tryVerify(function(){ return listView.currentItem }) - compare(listView.currentItem.text, "Hello") - \endcode - - \sa verify(), compare(), tryCompare(), SignalSpy::wait() - */ - function tryVerify(expressionFunction, timeout, msg) { - if (!expressionFunction || !(expressionFunction instanceof Function)) { - qtest_results.fail("First argument must be a function", util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - - if (timeout && typeof(timeout) !== "number") { - qtest_results.fail("timeout argument must be a number", util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - - if (msg && typeof(msg) !== "string") { - qtest_results.fail("message argument must be a string", util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - - if (!timeout) - timeout = 5000 - - if (msg === undefined) - msg = "function returned false" - - if (!expressionFunction()) - wait(0) - - var i = 0 - while (i < timeout && !expressionFunction()) { - wait(50) - i += 50 - } - - if (!qtest_results.verify(expressionFunction(), msg, util.callerFile(), util.callerLine())) - throw new Error("QtQuickTest::fail") - } - - /*! - \since 5.13 - \qmlmethod bool TestCase::isPolishScheduled(object item) - - Returns \c true if \l {QQuickItem::}{updatePolish()} has not been called - on \a item since the last call to \l {QQuickItem::}{polish()}, - otherwise returns \c false. - - When assigning values to properties in QML, any layouting the item - must do as a result of the assignment might not take effect immediately, - but can instead be postponed until the item is polished. For these cases, - you can use this function to ensure that the item has been polished - before the execution of the test continues. For example: - - \code - verify(isPolishScheduled(item)) - verify(waitForItemPolished(item)) - \endcode - - Without the call to \c isPolishScheduled() above, the - call to \c waitForItemPolished() might see that no polish - was scheduled and therefore pass instantly, assuming that - the item had already been polished. This function - makes it obvious why an item wasn't polished and allows tests to - fail early under such circumstances. - - \sa waitForItemPolished(), QQuickItem::polish(), QQuickItem::updatePolish() - */ - function isPolishScheduled(item) { - if (!item || typeof item !== "object") { - qtest_results.fail("Argument must be a valid Item; actual type is " + typeof item, - util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - - return qtest_results.isPolishScheduled(item) - } - - /*! - \since 5.13 - \qmlmethod bool waitForItemPolished(object item, int timeout = 5000) - - Waits for \a timeout milliseconds or until - \l {QQuickItem::}{updatePolish()} has been called on \a item. - - Returns \c true if \c updatePolish() was called on \a item within - \a timeout milliseconds, otherwise returns \c false. - - \sa isPolishScheduled(), QQuickItem::polish(), QQuickItem::updatePolish() - */ - function waitForItemPolished(item, timeout) { - if (!item || typeof item !== "object") { - qtest_results.fail("First argument must be a valid Item; actual type is " + typeof item, - util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - - if (timeout !== undefined && typeof(timeout) != "number") { - qtest_results.fail("Second argument must be a number; actual type is " + typeof timeout, - util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - - if (!timeout) - timeout = 5000 - - return qtest_results.waitForItemPolished(item, timeout) - } - - /*! - \since 5.9 - \qmlmethod object TestCase::createTemporaryQmlObject(string qml, object parent, string filePath) - - This function dynamically creates a QML object from the given \a qml - string with the specified \a parent. The returned object will be - destroyed (if it was not already) after \l cleanup() has finished - executing, meaning that objects created with this function are - guaranteed to be destroyed after each test, regardless of whether or - not the tests fail. - - If there was an error while creating the object, \c null will be - returned. - - If \a filePath is specified, it will be used for error reporting for - the created object. - - This function calls - \l {QtQml::Qt::createQmlObject()}{Qt.createQmlObject()} internally. - - \sa {Managing Dynamically Created Test Objects} - */ - function createTemporaryQmlObject(qml, parent, filePath) { - if (typeof qml !== "string") { - qtest_results.fail("First argument must be a string of QML; actual type is " + typeof qml, - util.callerFile(), util.callerLine()); - throw new Error("QtQuickTest::fail"); - } - - if (!parent || typeof parent !== "object") { - qtest_results.fail("Second argument must be a valid parent object; actual type is " + typeof parent, - util.callerFile(), util.callerLine()); - throw new Error("QtQuickTest::fail"); - } - - if (filePath !== undefined && typeof filePath !== "string") { - qtest_results.fail("Third argument must be a file path string; actual type is " + typeof filePath, - util.callerFile(), util.callerLine()); - throw new Error("QtQuickTest::fail"); - } - - var object = Qt.createQmlObject(qml, parent, filePath); - qtest_temporaryObjects.push(object); - return object; - } - - /*! - \since 5.9 - \qmlmethod object TestCase::createTemporaryObject(Component component, object parent, object properties) - - This function dynamically creates a QML object from the given - \a component with the specified optional \a parent and \a properties. - The returned object will be destroyed (if it was not already) after - \l cleanup() has finished executing, meaning that objects created with - this function are guaranteed to be destroyed after each test, - regardless of whether or not the tests fail. - - If there was an error while creating the object, \c null will be - returned. - - This function calls - \l {QtQml::Component::createObject()}{component.createObject()} - internally. - - \sa {Managing Dynamically Created Test Objects} - */ - function createTemporaryObject(component, parent, properties) { - if (typeof component !== "object") { - qtest_results.fail("First argument must be a Component; actual type is " + typeof component, - util.callerFile(), util.callerLine()); - throw new Error("QtQuickTest::fail"); - } - - if (properties && typeof properties !== "object") { - qtest_results.fail("Third argument must be an object; actual type is " + typeof properties, - util.callerFile(), util.callerLine()); - throw new Error("QtQuickTest::fail"); - } - - var object = component.createObject(parent, properties ? properties : ({})); - qtest_temporaryObjects.push(object); - return object; - } - - /*! - \internal - - Destroys all temporary objects that still exist. - */ - function qtest_destroyTemporaryObjects() { - for (var i = 0; i < qtest_temporaryObjects.length; ++i) { - var temporaryObject = qtest_temporaryObjects[i]; - // ### the typeof check can be removed when QTBUG-57749 is fixed - if (temporaryObject && typeof temporaryObject.destroy === "function") - temporaryObject.destroy(); - } - qtest_temporaryObjects = []; - } - - /*! \internal */ - // Determine what is o. - // Discussions and reference: http://philrathe.com/articles/equiv - // Test suites: http://philrathe.com/tests/equiv - // Author: Philippe Rathé <prathe@gmail.com> - function qtest_typeof(o) { - if (typeof o === "undefined") { - return "undefined"; - - // consider: typeof null === object - } else if (o === null) { - return "null"; - - } else if (o.constructor === String) { - return "string"; - - } else if (o.constructor === Boolean) { - return "boolean"; - - } else if (o.constructor === Number) { - - if (isNaN(o)) { - return "nan"; - } else { - return "number"; - } - // consider: typeof [] === object - } else if (o instanceof Array) { - return "array"; - - // consider: typeof new Date() === object - } else if (o instanceof Date) { - return "date"; - - // consider: /./ instanceof Object; - // /./ instanceof RegExp; - // typeof /./ === "function"; // => false in IE and Opera, - // true in FF and Safari - } else if (o instanceof RegExp) { - return "regexp"; - - } else if (typeof o === "object") { - if ("mapFromItem" in o && "mapToItem" in o) { - return "declarativeitem"; // @todo improve detection of declarative items - } else if ("x" in o && "y" in o && "z" in o) { - return "vector3d"; // Qt 3D vector - } - return "object"; - } else if (o instanceof Function) { - return "function"; - } else { - return undefined; - } - } - - /*! \internal */ - // Test for equality - // Large parts contain sources from QUnit or http://philrathe.com - // Discussions and reference: http://philrathe.com/articles/equiv - // Test suites: http://philrathe.com/tests/equiv - // Author: Philippe Rathé <prathe@gmail.com> - function qtest_compareInternal(act, exp) { - var success = false; - if (act === exp) { - success = true; // catch the most you can - } else if (act === null || exp === null || typeof act === "undefined" || typeof exp === "undefined") { - success = false; // don't lose time with error prone cases - } else { - var typeExp = qtest_typeof(exp), typeAct = qtest_typeof(act) - if (typeExp !== typeAct) { - // allow object vs string comparison (e.g. for colors) - // else break on different types - if ((typeExp === "string" && (typeAct === "object") || typeAct == "declarativeitem") - || ((typeExp === "object" || typeExp == "declarativeitem") && typeAct === "string")) { - success = (act == exp) - } - } else if (typeExp === "string" || typeExp === "boolean" || - typeExp === "null" || typeExp === "undefined") { - if (exp instanceof act.constructor || act instanceof exp.constructor) { - // to catch short annotaion VS 'new' annotation of act declaration - // e.g. var i = 1; - // var j = new Number(1); - success = (act == exp) - } else { - success = (act === exp) - } - } else if (typeExp === "nan") { - success = isNaN(act); - } else if (typeExp === "number") { - // Use act fuzzy compare if the two values are floats - if (Math.abs(act - exp) <= 0.00001) { - success = true - } - } else if (typeExp === "array") { - success = qtest_compareInternalArrays(act, exp) - } else if (typeExp === "object") { - success = qtest_compareInternalObjects(act, exp) - } else if (typeExp === "declarativeitem") { - success = qtest_compareInternalObjects(act, exp) // @todo improve comparison of declarative items - } else if (typeExp === "vector3d") { - success = (Math.abs(act.x - exp.x) <= 0.00001 && - Math.abs(act.y - exp.y) <= 0.00001 && - Math.abs(act.z - exp.z) <= 0.00001) - } else if (typeExp === "date") { - success = (act.valueOf() === exp.valueOf()) - } else if (typeExp === "regexp") { - success = (act.source === exp.source && // the regex itself - act.global === exp.global && // and its modifers (gmi) ... - act.ignoreCase === exp.ignoreCase && - act.multiline === exp.multiline) - } - } - return success - } - - /*! \internal */ - function qtest_compareInternalObjects(act, exp) { - var i; - var eq = true; // unless we can proove it - var aProperties = [], bProperties = []; // collection of strings - - // comparing constructors is more strict than using instanceof - if (act.constructor !== exp.constructor) { - return false; - } - - for (i in act) { // be strict: don't ensures hasOwnProperty and go deep - aProperties.push(i); // collect act's properties - if (!qtest_compareInternal(act[i], exp[i])) { - eq = false; - break; - } - } - - for (i in exp) { - bProperties.push(i); // collect exp's properties - } - - if (aProperties.length == 0 && bProperties.length == 0) { // at least a special case for QUrl - return eq && (JSON.stringify(act) == JSON.stringify(exp)); - } - - // Ensures identical properties name - return eq && qtest_compareInternal(aProperties.sort(), bProperties.sort()); - - } - - /*! \internal */ - function qtest_compareInternalArrays(actual, expected) { - if (actual.length != expected.length) { - return false - } - - for (var i = 0, len = actual.length; i < len; i++) { - if (!qtest_compareInternal(actual[i], expected[i])) { - return false - } - } - - return true - } - - /*! - \qmlmethod TestCase::compare(actual, expected, message = "") - - Fails the current test case if \a actual is not the same as - \a expected, and displays the optional \a message. Similar - to \c{QCOMPARE(actual, expected)} in C++. - - \sa tryCompare(), fuzzyCompare - */ - function compare(actual, expected, msg) { - var act = qtest_results.stringify(actual) - var exp = qtest_results.stringify(expected) - - var success = qtest_compareInternal(actual, expected) - if (msg === undefined) { - if (success) - msg = "COMPARE()" - else - msg = "Compared values are not the same" - } - if (!qtest_results.compare(success, msg, act, exp, util.callerFile(), util.callerLine())) { - throw new Error("QtQuickTest::fail") - } - } - - /*! - \qmlmethod TestCase::fuzzyCompare(actual, expected, delta, message = "") - - Fails the current test case if the difference betwen \a actual and \a expected - is greater than \a delta, and displays the optional \a message. Similar - to \c{qFuzzyCompare(actual, expected)} in C++ but with a required \a delta value. - - This function can also be used for color comparisons if both the \a actual and - \a expected values can be converted into color values. If any of the differences - for RGBA channel values are greater than \a delta, the test fails. - - \sa tryCompare(), compare() - */ - function fuzzyCompare(actual, expected, delta, msg) { - if (delta === undefined) - qtest_fail("A delta value is required for fuzzyCompare", 2) - - var success = qtest_results.fuzzyCompare(actual, expected, delta) - if (msg === undefined) { - if (success) - msg = "FUZZYCOMPARE()" - else - msg = "Compared values are not the same with delta(" + delta + ")" - } - - if (!qtest_results.compare(success, msg, actual, expected, util.callerFile(), util.callerLine())) { - throw new Error("QtQuickTest::fail") - } - } - - /*! - \qmlmethod object TestCase::grabImage(item) - - Returns a snapshot image object of the given \a item. - - The returned image object has the following properties: - \list - \li width Returns the width of the underlying image (since 5.10) - \li height Returns the height of the underlying image (since 5.10) - \li size Returns the size of the underlying image (since 5.10) - \endlist - - Additionally, the returned image object has the following methods: - \list - \li \c {red(x, y)} Returns the red channel value of the pixel at \e x, \e y position - \li \c {green(x, y)} Returns the green channel value of the pixel at \e x, \e y position - \li \c {blue(x, y)} Returns the blue channel value of the pixel at \e x, \e y position - \li \c {alpha(x, y)} Returns the alpha channel value of the pixel at \e x, \e y position - \li \c {pixel(x, y)} Returns the color value of the pixel at \e x, \e y position - \li \c {equals(image)} Returns \c true if this image is identical to \e image - - see \l QImage::operator== (since 5.6) - - For example: - - \code - var image = grabImage(rect); - compare(image.red(10, 10), 255); - compare(image.pixel(20, 20), Qt.rgba(255, 0, 0, 255)); - - rect.width += 10; - var newImage = grabImage(rect); - verify(!newImage.equals(image)); - \endcode - - \li \c {save(path)} Saves the image to the given \e path. If the image cannot - be saved, an exception will be thrown. (since 5.10) - - This can be useful to perform postmortem analysis on failing tests, for - example: - - \code - var image = grabImage(rect); - try { - compare(image.width, 100); - } catch (ex) { - image.save("debug.png"); - throw ex; - } - \endcode - - \endlist - */ - function grabImage(item) { - return qtest_results.grabImage(item); - } - - /*! - \since 5.4 - \qmlmethod QtObject TestCase::findChild(parent, objectName) - - Returns the first child of \a parent with \a objectName, or \c null if - no such item exists. Both visual and non-visual children are searched - recursively, with visual children being searched first. - - \code - compare(findChild(item, "childObject"), expectedChildObject); - \endcode - */ - function findChild(parent, objectName) { - // First, search the visual item hierarchy. - var child = qtest_findVisualChild(parent, objectName); - if (child) - return child; - - // If it's not a visual child, it might be a QObject child. - return qtest_results.findChild(parent, objectName); - } - - /*! \internal */ - function qtest_findVisualChild(parent, objectName) { - if (!parent || parent.children === undefined) - return null; - - for (var i = 0; i < parent.children.length; ++i) { - // Is this direct child of ours the child we're after? - var child = parent.children[i]; - if (child.objectName === objectName) - return child; - } - - for (i = 0; i < parent.children.length; ++i) { - // Try the direct child's children. - child = qtest_findVisualChild(parent.children[i], objectName); - if (child) - return child; - } - return null; - } - - /*! - \qmlmethod TestCase::tryCompare(obj, property, expected, timeout = 5000, message = "") - - Fails the current test case if the specified \a property on \a obj - is not the same as \a expected, and displays the optional \a message. - The test will be retried multiple times until the - \a timeout (in milliseconds) is reached. - - This function is intended for testing applications where a property - changes value based on asynchronous events. Use compare() for testing - synchronous property changes. - - \code - tryCompare(img, "status", BorderImage.Ready) - compare(img.width, 120) - compare(img.height, 120) - compare(img.horizontalTileMode, BorderImage.Stretch) - compare(img.verticalTileMode, BorderImage.Stretch) - \endcode - - SignalSpy::wait() provides an alternative method to wait for a - signal to be emitted. - - \sa compare(), SignalSpy::wait() - */ - function tryCompare(obj, prop, value, timeout, msg) { - if (arguments.length == 1 || (typeof(prop) != "string" && typeof(prop) != "number")) { - qtest_results.fail("A property name as string or index is required for tryCompare", - util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - if (arguments.length == 2) { - qtest_results.fail("A value is required for tryCompare", - util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - if (timeout !== undefined && typeof(timeout) != "number") { - qtest_results.fail("timeout should be a number", - util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::fail") - } - if (!timeout) - timeout = 5000 - if (msg === undefined) - msg = "property " + prop - if (!qtest_compareInternal(obj[prop], value)) - wait(0) - var i = 0 - while (i < timeout && !qtest_compareInternal(obj[prop], value)) { - wait(50) - i += 50 - } - var actual = obj[prop] - var act = qtest_results.stringify(actual) - var exp = qtest_results.stringify(value) - var success = qtest_compareInternal(actual, value) - if (!qtest_results.compare(success, msg, act, exp, util.callerFile(), util.callerLine())) - throw new Error("QtQuickTest::fail") - } - - /*! - \qmlmethod TestCase::skip(message = "") - - Skips the current test case and prints the optional \a message. - If this is a data-driven test, then only the current row is skipped. - Similar to \c{QSKIP(message)} in C++. - */ - function skip(msg) { - if (msg === undefined) - msg = "" - qtest_results.skip(msg, util.callerFile(), util.callerLine()) - throw new Error("QtQuickTest::skip") - } - - /*! - \qmlmethod TestCase::expectFail(tag, message) - - In a data-driven test, marks the row associated with \a tag as - expected to fail. When the fail occurs, display the \a message, - abort the test, and mark the test as passing. Similar to - \c{QEXPECT_FAIL(tag, message, Abort)} in C++. - - If the test is not data-driven, then \a tag must be set to - an empty string. - - \sa expectFailContinue() - */ - function expectFail(tag, msg) { - if (tag === undefined) { - warn("tag argument missing from expectFail()") - tag = "" - } - if (msg === undefined) { - warn("message argument missing from expectFail()") - msg = "" - } - if (!qtest_results.expectFail(tag, msg, util.callerFile(), util.callerLine())) - throw new Error("QtQuickTest::expectFail") - } - - /*! - \qmlmethod TestCase::expectFailContinue(tag, message) - - In a data-driven test, marks the row associated with \a tag as - expected to fail. When the fail occurs, display the \a message, - and then continue the test. Similar to - \c{QEXPECT_FAIL(tag, message, Continue)} in C++. - - If the test is not data-driven, then \a tag must be set to - an empty string. - - \sa expectFail() - */ - function expectFailContinue(tag, msg) { - if (tag === undefined) { - warn("tag argument missing from expectFailContinue()") - tag = "" - } - if (msg === undefined) { - warn("message argument missing from expectFailContinue()") - msg = "" - } - if (!qtest_results.expectFailContinue(tag, msg, util.callerFile(), util.callerLine())) - throw new Error("QtQuickTest::expectFail") - } - - /*! - \qmlmethod TestCase::warn(message) - - Prints \a message as a warning message. Similar to - \c{QWARN(message)} in C++. - - \sa ignoreWarning() - */ - function warn(msg) { - if (msg === undefined) - msg = "" - qtest_results.warn(msg, util.callerFile(), util.callerLine()); - } - - /*! - \qmlmethod TestCase::ignoreWarning(message) - - Marks \a message as an ignored warning message. When it occurs, - the warning will not be printed and the test passes. If the message - does not occur, then the test will fail. Similar to - \c{QTest::ignoreMessage(QtWarningMsg, message)} in C++. - - Since Qt 5.12, \a message can be either a string, or a regular - expression providing a pattern of messages to ignore. - - For example, the following snippet will ignore a string warning message: - \qml - ignoreWarning("Something sort of bad happened") - \endqml - - And the following snippet will ignore a regular expression matching a - number of possible warning messages: - \qml - ignoreWarning(new RegExp("[0-9]+ bad things happened")) - \endqml - - \note Despite being a JavaScript RegExp object, it will not be - interpreted as such; instead, the pattern will be passed to - \l QRegularExpression. - - \sa warn() - */ - function ignoreWarning(msg) { - if (msg === undefined) - msg = "" - qtest_results.ignoreWarning(msg) - } - - /*! - \qmlmethod TestCase::wait(ms) - - Waits for \a ms milliseconds while processing Qt events. - - \sa sleep(), waitForRendering() - */ - function wait(ms) { - qtest_results.wait(ms) - } - - /*! - \qmlmethod TestCase::waitForRendering(item, timeout = 5000) - - Waits for \a timeout milliseconds or until the \a item is rendered by the renderer. - Returns true if \c item is rendered in \a timeout milliseconds, otherwise returns false. - The default \a timeout value is 5000. - - \sa sleep(), wait() - */ - function waitForRendering(item, timeout) { - if (timeout === undefined) - timeout = 5000 - if (!qtest_verifyItem(item, "waitForRendering")) - return - return qtest_results.waitForRendering(item, timeout) - } - - /*! - \qmlmethod TestCase::sleep(ms) - - Sleeps for \a ms milliseconds without processing Qt events. - - \sa wait(), waitForRendering() - */ - function sleep(ms) { - qtest_results.sleep(ms) - } - - /*! - \qmlmethod TestCase::keyPress(key, modifiers = Qt.NoModifier, delay = -1) - - Simulates pressing a \a key with optional \a modifiers on the currently - focused item. If \a delay is larger than 0, the test will wait for - \a delay milliseconds. - - The event will be sent to the TestCase window or, in case of multiple windows, - to the current active window. See \l QGuiApplication::focusWindow() for more details. - - \b{Note:} At some point you should release the key using keyRelease(). - - \sa keyRelease(), keyClick() - */ - function keyPress(key, modifiers, delay) { - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (delay == undefined) - delay = -1 - if (typeof(key) == "string" && key.length == 1) { - if (!qtest_events.keyPressChar(key, modifiers, delay)) - qtest_fail("window not shown", 2) - } else { - if (!qtest_events.keyPress(key, modifiers, delay)) - qtest_fail("window not shown", 2) - } - } - - /*! - \qmlmethod TestCase::keyRelease(key, modifiers = Qt.NoModifier, delay = -1) - - Simulates releasing a \a key with optional \a modifiers on the currently - focused item. If \a delay is larger than 0, the test will wait for - \a delay milliseconds. - - The event will be sent to the TestCase window or, in case of multiple windows, - to the current active window. See \l QGuiApplication::focusWindow() for more details. - - \sa keyPress(), keyClick() - */ - function keyRelease(key, modifiers, delay) { - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (delay == undefined) - delay = -1 - if (typeof(key) == "string" && key.length == 1) { - if (!qtest_events.keyReleaseChar(key, modifiers, delay)) - qtest_fail("window not shown", 2) - } else { - if (!qtest_events.keyRelease(key, modifiers, delay)) - qtest_fail("window not shown", 2) - } - } - - /*! - \qmlmethod TestCase::keyClick(key, modifiers = Qt.NoModifier, delay = -1) - - Simulates clicking of \a key with optional \a modifiers on the currently - focused item. If \a delay is larger than 0, the test will wait for - \a delay milliseconds. - - The event will be sent to the TestCase window or, in case of multiple windows, - to the current active window. See \l QGuiApplication::focusWindow() for more details. - - \sa keyPress(), keyRelease() - */ - function keyClick(key, modifiers, delay) { - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (delay == undefined) - delay = -1 - if (typeof(key) == "string" && key.length == 1) { - if (!qtest_events.keyClickChar(key, modifiers, delay)) - qtest_fail("window not shown", 2) - } else { - if (!qtest_events.keyClick(key, modifiers, delay)) - qtest_fail("window not shown", 2) - } - } - - /*! - \since 5.10 - \qmlmethod TestCase::keySequence(keySequence) - - Simulates typing of \a keySequence. The key sequence can be set - to one of the \l{QKeySequence::StandardKey}{standard keyboard shortcuts}, or - it can be described with a string containing a sequence of up to four key - presses. - - Each event shall be sent to the TestCase window or, in case of multiple windows, - to the current active window. See \l QGuiApplication::focusWindow() for more details. - - \sa keyPress(), keyRelease(), {GNU Emacs Style Key Sequences}, - {QtQuick::Shortcut::sequence}{Shortcut.sequence} - */ - function keySequence(keySequence) { - if (!qtest_events.keySequence(keySequence)) - qtest_fail("window not shown", 2) - } - - /*! - \qmlmethod TestCase::mousePress(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) - - Simulates pressing a mouse \a button with optional \a modifiers - on an \a item. The position is defined by \a x and \a y. - If \a x or \a y are not defined the position will be the center of \a item. - If \a delay is specified, the test will wait for the specified amount of - milliseconds before the press. - - The position given by \a x and \a y is transformed from the co-ordinate - system of \a item into window co-ordinates and then delivered. - If \a item is obscured by another item, or a child of \a item occupies - that position, then the event will be delivered to the other item instead. - - \sa mouseRelease(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() - */ - function mousePress(item, x, y, button, modifiers, delay) { - if (!qtest_verifyItem(item, "mousePress")) - return - - if (button === undefined) - button = Qt.LeftButton - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (delay == undefined) - delay = -1 - if (x === undefined) - x = item.width / 2 - if (y === undefined) - y = item.height / 2 - if (!qtest_events.mousePress(item, x, y, button, modifiers, delay)) - qtest_fail("window not shown", 2) - } - - /*! - \qmlmethod TestCase::mouseRelease(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) - - Simulates releasing a mouse \a button with optional \a modifiers - on an \a item. The position of the release is defined by \a x and \a y. - If \a x or \a y are not defined the position will be the center of \a item. - If \a delay is specified, the test will wait for the specified amount of - milliseconds before releasing the button. - - The position given by \a x and \a y is transformed from the co-ordinate - system of \a item into window co-ordinates and then delivered. - If \a item is obscured by another item, or a child of \a item occupies - that position, then the event will be delivered to the other item instead. - - \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() - */ - function mouseRelease(item, x, y, button, modifiers, delay) { - if (!qtest_verifyItem(item, "mouseRelease")) - return - - if (button === undefined) - button = Qt.LeftButton - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (delay == undefined) - delay = -1 - if (x === undefined) - x = item.width / 2 - if (y === undefined) - y = item.height / 2 - if (!qtest_events.mouseRelease(item, x, y, button, modifiers, delay)) - qtest_fail("window not shown", 2) - } - - /*! - \qmlmethod TestCase::mouseDrag(item, x, y, dx, dy, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) - - Simulates dragging the mouse on an \a item with \a button pressed and optional \a modifiers - The initial drag position is defined by \a x and \a y, - and drag distance is defined by \a dx and \a dy. If \a delay is specified, - the test will wait for the specified amount of milliseconds before releasing the button. - - The position given by \a x and \a y is transformed from the co-ordinate - system of \a item into window co-ordinates and then delivered. - If \a item is obscured by another item, or a child of \a item occupies - that position, then the event will be delivered to the other item instead. - - \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel() - */ - function mouseDrag(item, x, y, dx, dy, button, modifiers, delay) { - if (!qtest_verifyItem(item, "mouseDrag")) - return - - if (item.x === undefined || item.y === undefined) - return - if (button === undefined) - button = Qt.LeftButton - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (delay == undefined) - delay = -1 - var moveDelay = Math.max(1, delay === -1 ? qtest_events.defaultMouseDelay : delay) - - // Divide dx and dy to have intermediate mouseMove while dragging - // Fractions of dx/dy need be superior to the dragThreshold - // to make the drag works though - var intermediateDx = Math.round(dx/3) - if (Math.abs(intermediateDx) < (util.dragThreshold + 1)) - intermediateDx = 0 - var intermediateDy = Math.round(dy/3) - if (Math.abs(intermediateDy) < (util.dragThreshold + 1)) - intermediateDy = 0 - - mousePress(item, x, y, button, modifiers, delay) - - // Trigger dragging by dragging past the drag threshold, but making sure to only drag - // along a certain axis if a distance greater than zero was given for that axis. - var dragTriggerXDistance = dx > 0 ? (util.dragThreshold + 1) : 0 - var dragTriggerYDistance = dy > 0 ? (util.dragThreshold + 1) : 0 - mouseMove(item, x + dragTriggerXDistance, y + dragTriggerYDistance, moveDelay, button) - if (intermediateDx !== 0 || intermediateDy !== 0) { - mouseMove(item, x + intermediateDx, y + intermediateDy, moveDelay, button) - mouseMove(item, x + 2*intermediateDx, y + 2*intermediateDy, moveDelay, button) - } - mouseMove(item, x + dx, y + dy, moveDelay, button) - mouseRelease(item, x + dx, y + dy, button, modifiers, delay) - } - - /*! - \qmlmethod TestCase::mouseClick(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) - - Simulates clicking a mouse \a button with optional \a modifiers - on an \a item. The position of the click is defined by \a x and \a y. - If \a x and \a y are not defined the position will be the center of \a item. - If \a delay is specified, the test will wait for the specified amount of - milliseconds before pressing and before releasing the button. - - The position given by \a x and \a y is transformed from the co-ordinate - system of \a item into window co-ordinates and then delivered. - If \a item is obscured by another item, or a child of \a item occupies - that position, then the event will be delivered to the other item instead. - - \sa mousePress(), mouseRelease(), mouseDoubleClickSequence(), mouseMove(), mouseDrag(), mouseWheel() - */ - function mouseClick(item, x, y, button, modifiers, delay) { - if (!qtest_verifyItem(item, "mouseClick")) - return - - if (button === undefined) - button = Qt.LeftButton - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (delay == undefined) - delay = -1 - if (x === undefined) - x = item.width / 2 - if (y === undefined) - y = item.height / 2 - if (!qtest_events.mouseClick(item, x, y, button, modifiers, delay)) - qtest_fail("window not shown", 2) - } - - /*! - \qmlmethod TestCase::mouseDoubleClickSequence(item, x = item.width / 2, y = item.height / 2, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) - - Simulates the full sequence of events generated by double-clicking a mouse - \a button with optional \a modifiers on an \a item. - - This method reproduces the sequence of mouse events generated when a user makes - a double click: Press-Release-Press-DoubleClick-Release. - - The position of the click is defined by \a x and \a y. - If \a x and \a y are not defined the position will be the center of \a item. - If \a delay is specified, the test will wait for the specified amount of - milliseconds before pressing and before releasing the button. - - The position given by \a x and \a y is transformed from the co-ordinate - system of \a item into window co-ordinates and then delivered. - If \a item is obscured by another item, or a child of \a item occupies - that position, then the event will be delivered to the other item instead. - - This QML method was introduced in Qt 5.5. - - \sa mousePress(), mouseRelease(), mouseClick(), mouseMove(), mouseDrag(), mouseWheel() - */ - function mouseDoubleClickSequence(item, x, y, button, modifiers, delay) { - if (!qtest_verifyItem(item, "mouseDoubleClickSequence")) - return - - if (button === undefined) - button = Qt.LeftButton - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (delay == undefined) - delay = -1 - if (x === undefined) - x = item.width / 2 - if (y === undefined) - y = item.height / 2 - if (!qtest_events.mouseDoubleClickSequence(item, x, y, button, modifiers, delay)) - qtest_fail("window not shown", 2) - } - - /*! - \qmlmethod TestCase::mouseMove(item, x = item.width / 2, y = item.height / 2, delay = -1, buttons = Qt.NoButton) - - Moves the mouse pointer to the position given by \a x and \a y within - \a item, while holding \a buttons if given. Since Qt 6.0, if \a x and - \a y are not defined, the position will be the center of \a item. - - If a \a delay (in milliseconds) is given, the test will wait before - moving the mouse pointer. - - The position given by \a x and \a y is transformed from the co-ordinate - system of \a item into window co-ordinates and then delivered. - If \a item is obscured by another item, or a child of \a item occupies - that position, then the event will be delivered to the other item instead. - - \sa mousePress(), mouseRelease(), mouseClick(), mouseDoubleClickSequence(), mouseDrag(), mouseWheel() - */ - function mouseMove(item, x, y, delay, buttons) { - if (!qtest_verifyItem(item, "mouseMove")) - return - - if (delay == undefined) - delay = -1 - if (buttons == undefined) - buttons = Qt.NoButton - if (x === undefined) - x = item.width / 2 - if (y === undefined) - y = item.height / 2 - if (!qtest_events.mouseMove(item, x, y, delay, buttons)) - qtest_fail("window not shown", 2) - } - - /*! - \qmlmethod TestCase::mouseWheel(item, x, y, xDelta, yDelta, button = Qt.LeftButton, modifiers = Qt.NoModifier, delay = -1) - - Simulates rotating the mouse wheel on an \a item with \a button pressed and optional \a modifiers. - The position of the wheel event is defined by \a x and \a y. - If \a delay is specified, the test will wait for the specified amount of milliseconds before releasing the button. - - The position given by \a x and \a y is transformed from the co-ordinate - system of \a item into window co-ordinates and then delivered. - If \a item is obscured by another item, or a child of \a item occupies - that position, then the event will be delivered to the other item instead. - - The \a xDelta and \a yDelta contain the wheel rotation distance in eighths of a degree. see \l QWheelEvent::angleDelta() for more details. - - \sa mousePress(), mouseClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseDrag(), QWheelEvent::angleDelta() - */ - function mouseWheel(item, x, y, xDelta, yDelta, buttons, modifiers, delay) { - if (!qtest_verifyItem(item, "mouseWheel")) - return - - if (delay == undefined) - delay = -1 - if (buttons == undefined) - buttons = Qt.NoButton - if (modifiers === undefined) - modifiers = Qt.NoModifier - if (xDelta == undefined) - xDelta = 0 - if (yDelta == undefined) - yDelta = 0 - if (!qtest_events.mouseWheel(item, x, y, buttons, modifiers, xDelta, yDelta, delay)) - qtest_fail("window not shown", 2) - } - - /*! - \qmlmethod TouchEventSequence TestCase::touchEvent(object item) - - \since 5.9 - - Begins a sequence of touch events through a simulated touchscreen (QPointingDevice). - Events are delivered to the window containing \a item. - - The returned object is used to enumerate events to be delivered through a single - QTouchEvent. Touches are delivered to the window containing the TestCase unless - otherwise specified. - - \code - Rectangle { - width: 640; height: 480 - - MultiPointTouchArea { - id: area - anchors.fill: parent - - property bool touched: false - - onPressed: touched = true - } - - TestCase { - name: "ItemTests" - when: windowShown - id: test1 - - function test_touch() { - var touch = touchEvent(area); - touch.press(0, area, 10, 10); - touch.commit(); - verify(area.touched); - } - } - } - \endcode - - \sa TouchEventSequence::press(), TouchEventSequence::move(), TouchEventSequence::release(), TouchEventSequence::stationary(), TouchEventSequence::commit(), QInputDevice::DeviceType - */ - - function touchEvent(item) { - if (!qtest_verifyItem(item, "touchEvent")) - return - - return { - _defaultItem: item, - _sequence: qtest_events.touchEvent(item), - - press: function (id, target, x, y) { - if (!target) - target = this._defaultItem; - if (id === undefined) - qtest_fail("No id given to TouchEventSequence::press", 1); - if (x === undefined) - x = target.width / 2; - if (y === undefined) - y = target.height / 2; - this._sequence.press(id, target, x, y); - return this; - }, - - move: function (id, target, x, y) { - if (!target) - target = this._defaultItem; - if (id === undefined) - qtest_fail("No id given to TouchEventSequence::move", 1); - if (x === undefined) - x = target.width / 2; - if (y === undefined) - y = target.height / 2; - this._sequence.move(id, target, x, y); - return this; - }, - - stationary: function (id) { - if (id === undefined) - qtest_fail("No id given to TouchEventSequence::stationary", 1); - this._sequence.stationary(id); - return this; - }, - - release: function (id, target, x, y) { - if (!target) - target = this._defaultItem; - if (id === undefined) - qtest_fail("No id given to TouchEventSequence::release", 1); - if (x === undefined) - x = target.width / 2; - if (y === undefined) - y = target.height / 2; - this._sequence.release(id, target, x, y); - return this; - }, - - commit: function () { - this._sequence.commit(); - return this; - } - }; - } - - // Functions that can be overridden in subclasses for init/cleanup duties. - /*! - \qmlmethod TestCase::initTestCase() - - This function is called before any other test functions in the - \l TestCase type. The default implementation does nothing. - The application can provide its own implementation to perform - test case initialization. - - \sa cleanupTestCase(), init() - */ - function initTestCase() {} - - /*! - \qmlmethod TestCase::cleanupTestCase() - - This function is called after all other test functions in the - \l TestCase type have completed. The default implementation - does nothing. The application can provide its own implementation - to perform test case cleanup. - - \sa initTestCase(), cleanup() - */ - function cleanupTestCase() {} - - /*! - \qmlmethod TestCase::init() - - This function is called before each test function that is - executed in the \l TestCase type. The default implementation - does nothing. The application can provide its own implementation - to perform initialization before each test function. - - \sa cleanup(), initTestCase() - */ - function init() {} - - /*! - \qmlmethod TestCase::cleanup() - - This function is called after each test function that is - executed in the \l TestCase type. The default implementation - does nothing. The application can provide its own implementation - to perform cleanup after each test function. - - \sa init(), cleanupTestCase() - */ - function cleanup() {} - - /*! \internal */ - function qtest_verifyItem(item, method) { - try { - if (!(item instanceof Item) && - !(item instanceof Window)) { - // it's a QObject, but not a type - qtest_fail("TypeError: %1 requires an Item or Window type".arg(method), 2); - return false; - } - } catch (e) { // it's not a QObject - qtest_fail("TypeError: %1 requires an Item or Window type".arg(method), 3); - return false; - } - - return true; - } - - /*! \internal */ - function qtest_runInternal(prop, arg) { - try { - qtest_testCaseResult = testCase[prop](arg) - } catch (e) { - qtest_testCaseResult = [] - if (e.message.indexOf("QtQuickTest::") != 0) { - // Test threw an unrecognized exception - fail. - qtest_results.fail("Uncaught exception: " + e.message, - e.fileName, e.lineNumber) - } - } - return !qtest_results.failed - } - - /*! \internal */ - function qtest_runFunction(prop, arg) { - qtest_runInternal("init") - if (!qtest_results.skipped) { - qtest_runInternal(prop, arg) - qtest_results.finishTestData() - qtest_runInternal("cleanup") - qtest_destroyTemporaryObjects() - qtest_results.finishTestDataCleanup() - // wait(0) will call processEvents() so objects marked for deletion - // in the test function will be deleted. - wait(0) - } - } - - /*! \internal */ - function qtest_runBenchmarkFunction(prop, arg) { - qtest_results.startMeasurement() - do { - qtest_results.beginDataRun() - do { - // Run the initialization function. - qtest_runInternal("init") - if (qtest_results.skipped) - break - - // Execute the benchmark function. - if (prop.indexOf("benchmark_once_") != 0) - qtest_results.startBenchmark(TestResult.RepeatUntilValidMeasurement, qtest_results.dataTag) - else - qtest_results.startBenchmark(TestResult.RunOnce, qtest_results.dataTag) - while (!qtest_results.isBenchmarkDone()) { - var success = qtest_runInternal(prop, arg) - qtest_results.finishTestData() - if (!success) - break - qtest_results.nextBenchmark() - } - qtest_results.stopBenchmark() - - // Run the cleanup function. - qtest_runInternal("cleanup") - qtest_results.finishTestDataCleanup() - // wait(0) will call processEvents() so objects marked for deletion - // in the test function will be deleted. - wait(0) - } while (!qtest_results.measurementAccepted()) - qtest_results.endDataRun() - } while (qtest_results.needsMoreMeasurements()) - } - - /*! \internal */ - function qtest_run() { - if (TestLogger.log_start_test()) { - qtest_results.reset() - qtest_results.testCaseName = name - qtest_results.startLogging() - } else { - qtest_results.testCaseName = name - } - running = true - - // Check the run list to see if this class is mentioned. - let checkNames = false - let testsToRun = {} // explicitly provided function names to run and their tags for data-driven tests - - if (qtest_results.functionsToRun.length > 0) { - checkNames = true - var found = false - - if (name.length > 0) { - for (var index in qtest_results.functionsToRun) { - let caseFuncName = qtest_results.functionsToRun[index] - if (caseFuncName.indexOf(name + "::") != 0) - continue - - found = true - let funcName = caseFuncName.substring(name.length + 2) - - if (!(funcName in testsToRun)) - testsToRun[funcName] = [] - - let tagName = qtest_results.tagsToRun[index] - if (tagName.length > 0) // empty tags mean run all rows - testsToRun[funcName].push(tagName) - } - } - if (!found) { - completed = true - if (!TestLogger.log_complete_test(qtest_testId)) { - qtest_results.stopLogging() - Qt.quit() - } - qtest_results.testCaseName = "" - return - } - } - - // Run the initTestCase function. - qtest_results.functionName = "initTestCase" - var runTests = true - if (!qtest_runInternal("initTestCase")) - runTests = false - qtest_results.finishTestData() - qtest_results.finishTestDataCleanup() - qtest_results.finishTestFunction() - - // Run the test methods. - var testList = [] - if (runTests) { - for (var prop in testCase) { - if (prop.indexOf("test_") != 0 && prop.indexOf("benchmark_") != 0) - continue - var tail = prop.lastIndexOf("_data"); - if (tail != -1 && tail == (prop.length - 5)) - continue - testList.push(prop) - } - testList.sort() - } - - for (var index in testList) { - var prop = testList[index] - - if (checkNames && !(prop in testsToRun)) - continue - - var datafunc = prop + "_data" - var isBenchmark = (prop.indexOf("benchmark_") == 0) - qtest_results.functionName = prop - - if (!(datafunc in testCase)) - datafunc = "init_data"; - - if (datafunc in testCase) { - if (qtest_runInternal(datafunc)) { - var table = qtest_testCaseResult - var haveData = false - - let checkTags = (checkNames && testsToRun[prop].length > 0) - - qtest_results.initTestTable() - for (var index in table) { - haveData = true - var row = table[index] - if (!row.tag) - row.tag = "row " + index // Must have something - if (checkTags) { - let tags = testsToRun[prop] - let tagIdx = tags.indexOf(row.tag) - if (tagIdx < 0) - continue - tags.splice(tagIdx, 1) - } - qtest_results.dataTag = row.tag - if (isBenchmark) - qtest_runBenchmarkFunction(prop, row) - else - qtest_runFunction(prop, row) - qtest_results.dataTag = "" - qtest_results.skipped = false - } - if (!haveData) { - if (datafunc === "init_data") - qtest_runFunction(prop, null, isBenchmark) - else - qtest_results.warn("no data supplied for " + prop + "() by " + datafunc + "()" - , util.callerFile(), util.callerLine()); - } - qtest_results.clearTestTable() - } - } else if (isBenchmark) { - qtest_runBenchmarkFunction(prop, null, isBenchmark) - } else { - qtest_runFunction(prop, null, isBenchmark) - } - qtest_results.finishTestFunction() - qtest_results.skipped = false - - if (checkNames && testsToRun[prop].length <= 0) - delete testsToRun[prop] - } - - // Run the cleanupTestCase function. - qtest_results.skipped = false - qtest_results.functionName = "cleanupTestCase" - qtest_runInternal("cleanupTestCase") - - // Complain about missing functions that we were supposed to run. - if (checkNames) { - let missingTests = [] - for (var func in testsToRun) { - let caseFuncName = name + '::' + func - let tags = testsToRun[func] - if (tags.length <= 0) - missingTests.push(caseFuncName) - else - for (var i in tags) - missingTests.push(caseFuncName + ':' + tags[i]) - } - missingTests.sort() - if (missingTests.length > 0) - qtest_results.fail("Could not find test functions: " + missingTests, "", 0) - } - - // Clean up and exit. - running = false - completed = true - qtest_results.finishTestData() - qtest_results.finishTestDataCleanup() - qtest_results.finishTestFunction() - qtest_results.functionName = "" - - // Stop if there are no more tests to be run. - if (!TestLogger.log_complete_test(qtest_testId)) { - qtest_results.stopLogging() - Qt.quit() - } - qtest_results.testCaseName = "" - } - - onWhenChanged: { - if (when != qtest_prevWhen) { - qtest_prevWhen = when - if (when && !completed && !running && qtest_componentCompleted) - qtest_run() - } - } - - onOptionalChanged: { - if (!completed) { - if (optional) - TestLogger.log_optional_test(qtest_testId) - else - TestLogger.log_mandatory_test(qtest_testId) - } - } - - Component.onCompleted: { - QTestRootObject.hasTestCase = true; - qtest_componentCompleted = true; - qtest_testId = TestLogger.log_register_test(name) - if (optional) - TestLogger.log_optional_test(qtest_testId) - qtest_prevWhen = when - if (when && !completed && !running) - qtest_run() - } -} diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp deleted file mode 100644 index 8981ac0ff0..0000000000 --- a/src/imports/testlib/main.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQuickTest/private/quicktestglobal_p.h> - -QT_BEGIN_NAMESPACE - -class QTestQmlModule : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) - -public: - QTestQmlModule(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtTest; - Q_UNUSED(registration); - } -}; - -QT_END_NAMESPACE - -#include "main.moc" diff --git a/src/imports/testlib/testlogger.js b/src/imports/testlib/testlogger.js deleted file mode 100644 index 52a79806b9..0000000000 --- a/src/imports/testlib/testlogger.js +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -.pragma library - -var testResults = null; - -function log_init_results() -{ - if (!testResults) { - testResults = { - reportedStart: false, - nextId: 0, - testCases: [] - } - } -} - -function log_register_test(name) -{ - log_init_results() - var testId = testResults.nextId++ - testResults.testCases.push(testId) - return testId -} - -function log_optional_test(testId) -{ - log_init_results() - var index = testResults.testCases.indexOf(testId) - if (index >= 0) - testResults.testCases.splice(index, 1) -} - -function log_mandatory_test(testId) -{ - log_init_results() - var index = testResults.testCases.indexOf(testId) - if (index == -1) - testResults.testCases.push(testId) -} - -function log_start_test() -{ - log_init_results() - if (testResults.reportedStart) - return false - testResults.reportedStart = true - return true -} - -function log_complete_test(testId) -{ - var index = testResults.testCases.indexOf(testId) - if (index >= 0) - testResults.testCases.splice(index, 1) - return testResults.testCases.length > 0 -} diff --git a/src/imports/testlib/toucheventsequence.qdoc b/src/imports/testlib/toucheventsequence.qdoc deleted file mode 100644 index 92c5836d49..0000000000 --- a/src/imports/testlib/toucheventsequence.qdoc +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Jeremy Katz -** 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$ -** -****************************************************************************/ - -/*! - \qmltype TouchEventSequence - \inqmlmodule QtTest - \ingroup qtquicktest - \brief TouchEventSequence is used to build and dispatch touch events - for testing. - - \since 5.9 - - A TouchEventSequence is created by calling \l [QML] {TestCase::touchEvent()}{TestCase.touchEvent()}. - The type can not be directly instantiated. Each method provided by the type returns - the same object, allowing chained calls. - - For example: - \code - touchEvent(item).press(0).commit(); - \endcode - is equivalent to: - \code - var sequence = touchEvent(item); - sequence.press(0); - sequence.commit(); - \endcode - - Events are delivered to the window which contains the item specified in touchEvent. - - \sa TestCase::touchEvent() -*/ - -/*! - \qmlmethod TouchEventSequence TouchEventSequence::press(int touchId, object item, real x = item.width / 2, real y = item.height / 2) - - Creates a new point identified as \a touchId, at the point indicated by \a x and \a y relative to \a item. - Further use of the same touch point should maintain the same touchId. - - Item defaults to the value provided via touchEvent(). - X and y default to the midpoint of the item. -*/ - -/*! - \qmlmethod TouchEventSequence TouchEventSequence::move(int touchId, object item, real x = item.width / 2, real y = item.height / 2) - - Moves \a touchId to the point indicated by \a x and \a y relative to \a item. - - Item defaults to the value provided via touchEvent(). - X and y default to the midpoint of the item. -*/ - -/*! - \qmlmethod TouchEventSequence TouchEventSequence::release(int touchId, object item, real x = item.width / 2, real y = item.height / 2) - - Removes \a touchId at the point indicated by \a x and \a y relative to \a item. - - Item defaults to the value provided via touchEvent(). - X and y default to the midpoint of the item. -*/ - -/*! - \qmlmethod TouchEventSequence TouchEventSequence::stationary(int touchId) - - Indicates that \a touchId is present but otherwise unchanged from prior events. -*/ - -/*! - \qmlmethod TouchEventSequence TouchEventSequence::commit() - - Sends the touch event composed by prior use of press(), move(), release(), and stationary(). - Following commit's return, the TouchEventSequence can be used to compose a new event. - - \code - var sequence = touchEvent(target); - // Touch the middle of target with 1 point - sequence.press(1); - sequence.commit(); - - // Begin a new event - // Move the point to target's upper left corner - sequence.move(1, target, 0, 0); - sequence.commit(); - \endcode - - Commit is automatically invoked when the TouchEventSequence object is destroyed. -*/ diff --git a/src/imports/tooling/CMakeLists.txt b/src/imports/tooling/CMakeLists.txt index c36c8c1474..c58a2274e5 100644 --- a/src/imports/tooling/CMakeLists.txt +++ b/src/imports/tooling/CMakeLists.txt @@ -1,5 +1,5 @@ -# Generated from tooling.pro. -# special case skip regeneration +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause set(qml_files "Component.qml" @@ -12,20 +12,16 @@ set(qml_files "Signal.qml" ) -qt_internal_add_qml_module(quicktooling - URI "QtQuick.tooling" - VERSION "${CMAKE_PROJECT_VERSION}" - GENERATE_QMLTYPES - INSTALL_QMLTYPES - PAST_MAJOR_VERSIONS 1 -) - set_source_files_properties(${qml_files} PROPERTIES - QT_QML_SOURCE_VERSION "1.2;6.0" + QT_QML_SOURCE_VERSIONS "1.2;6.0" ) -qt6_target_qml_files(quicktooling - FILES - ${qml_files} +qt_internal_add_qml_module(quicktooling + URI "QtQuick.tooling" + NO_SYNC_QT + VERSION "${PROJECT_VERSION}" + NO_PLUGIN_OPTIONAL + PLUGIN_TARGET quicktooling + PAST_MAJOR_VERSIONS 1 + QML_FILES ${qml_files} ) - diff --git a/src/imports/tooling/Component.qml b/src/imports/tooling/Component.qml index 942d838900..6a5cde3c2a 100644 --- a/src/imports/tooling/Component.qml +++ b/src/imports/tooling/Component.qml @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QML @@ -44,16 +8,24 @@ QtObject { property string file required property string name + property list<string> aliases: [] property string prototype - property var exports: [] - property var exportMetaObjectRevisions: [] - property var interfaces: [] + property list<string> exports: [] + property list<int> exportMetaObjectRevisions + property list<string> interfaces + property list<string> deferredNames + property list<string> immediateNames property string attachedType property string valueType property string extension property bool isSingleton: false - property bool isCreatable: name.length > 0 + property bool isCreatable: accessSemantics === "reference" && name.length > 0 + property bool isStructured: false property bool isComposite: false + property bool hasCustomParser: false + property bool extensionIsJavaScript: false + property bool extensionIsNamespace: false property string accessSemantics: "reference" property string defaultProperty + property string parentProperty } diff --git a/src/imports/tooling/Enum.qml b/src/imports/tooling/Enum.qml index cd5904b6b6..04276fdeed 100644 --- a/src/imports/tooling/Enum.qml +++ b/src/imports/tooling/Enum.qml @@ -1,46 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QML Member { property string alias + property string type property bool isFlag: false + property bool isScoped: false property var values: [] } diff --git a/src/imports/tooling/Member.qml b/src/imports/tooling/Member.qml index 5fc1466ff0..9df4fa76a2 100644 --- a/src/imports/tooling/Member.qml +++ b/src/imports/tooling/Member.qml @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QML diff --git a/src/imports/tooling/Method.qml b/src/imports/tooling/Method.qml index f867a4eb27..cab07f6e38 100644 --- a/src/imports/tooling/Method.qml +++ b/src/imports/tooling/Method.qml @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QML @@ -43,4 +7,10 @@ Member { default property list<Parameter> parameters property string type property int revision: 0 + property bool isConstructor: false + property bool isList: false + property bool isPointer: false + property bool isJavaScriptFunction: false + property bool isCloned: false + property bool isConstant: false } diff --git a/src/imports/tooling/Module.qml b/src/imports/tooling/Module.qml index b03475fbaf..4aa9312a36 100644 --- a/src/imports/tooling/Module.qml +++ b/src/imports/tooling/Module.qml @@ -1,45 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QML QtObject { default property list<Component> components - property var dependencies: [] + property list<string> dependencies: [] } diff --git a/src/imports/tooling/Parameter.qml b/src/imports/tooling/Parameter.qml index a45f9d33ff..0f44074284 100644 --- a/src/imports/tooling/Parameter.qml +++ b/src/imports/tooling/Parameter.qml @@ -1,46 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QML QtObject { - required property string name - required property string type + property string name + property string type property bool isPointer: false + property bool isList: false + property bool isConstant: false } diff --git a/src/imports/tooling/Property.qml b/src/imports/tooling/Property.qml index de76df55b3..ba21db566c 100644 --- a/src/imports/tooling/Property.qml +++ b/src/imports/tooling/Property.qml @@ -1,51 +1,22 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QML Member { - required property string type + property string type property bool isPointer: false property bool isReadonly: false + property bool isRequired: false property bool isList: false + property bool isFinal: false + property bool isConstant: false property int revision: 0 property string bindable property string read property string write + property string reset + property string notify + property string privateClass + property int index: -1 } diff --git a/src/imports/tooling/Signal.qml b/src/imports/tooling/Signal.qml index 4ac1dc1fea..b9111a1555 100644 --- a/src/imports/tooling/Signal.qml +++ b/src/imports/tooling/Signal.qml @@ -1,45 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only import QML Member { default property list<Parameter> parameters property int revision: 0 + property string type + property bool isCloned: false } diff --git a/src/imports/wavefrontmesh/CMakeLists.txt b/src/imports/wavefrontmesh/CMakeLists.txt deleted file mode 100644 index 7dd97c8056..0000000000 --- a/src/imports/wavefrontmesh/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Generated from wavefrontmesh.pro. - -##################################################################### -## qmlwavefrontmeshplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(qmlwavefrontmeshplugin - URI "Qt.labs.wavefrontmesh" - VERSION "${CMAKE_PROJECT_VERSION}" - CLASSNAME QmlWavefrontMeshPlugin - SKIP_TYPE_REGISTRATION - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::QmlPrivate - Qt::LabsWavefrontMeshPrivate -) - -#### Keys ignored in scope 1:.:.:wavefrontmesh.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "Qt/labs/wavefrontmesh" diff --git a/src/imports/wavefrontmesh/plugin.cpp b/src/imports/wavefrontmesh/plugin.cpp deleted file mode 100644 index 16c40ae8d5..0000000000 --- a/src/imports/wavefrontmesh/plugin.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <QtLabsWavefrontMesh/private/qqmlwavefrontmeshglobal_p.h> -QT_BEGIN_NAMESPACE - -class QmlWavefrontMeshPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) -public: - QmlWavefrontMeshPlugin(QObject *parent = nullptr) - : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_Qt_labs_wavefrontmesh; - Q_UNUSED(registration); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" diff --git a/src/imports/wavefrontmesh/qwavefrontmesh.cpp b/src/imports/wavefrontmesh/qwavefrontmesh.cpp deleted file mode 100644 index 6be5c3d73f..0000000000 --- a/src/imports/wavefrontmesh/qwavefrontmesh.cpp +++ /dev/null @@ -1,681 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwavefrontmesh.h" - -#include <QtCore/qfile.h> -#include <QtCore/qtextstream.h> -#include <QtCore/private/qobject_p.h> - -#include <QtGui/qvector2d.h> -#include <QtGui/qvector3d.h> - -#include <QtQml/qqmlfile.h> -#include <QtQml/qqmlcontext.h> - -#include <QtQuick/qsggeometry.h> - -QT_BEGIN_NAMESPACE - -class QWavefrontMeshPrivate : public QObjectPrivate -{ -public: - QWavefrontMeshPrivate() - : lastError(QWavefrontMesh::NoError) - {} - - Q_DECLARE_PUBLIC(QWavefrontMesh) - - static QWavefrontMeshPrivate *get(QWavefrontMesh *mesh) - { - return mesh->d_func(); - } - - static const QWavefrontMeshPrivate *get(const QWavefrontMesh *mesh) - { - return mesh->d_func(); - } - - QVector<QPair<ushort, ushort> > indexes; - QVector<QVector3D> vertexes; - QVector<QVector2D> textureCoordinates; - - QUrl source; - QWavefrontMesh::Error lastError; - - QVector3D planeV; - QVector3D planeW; -}; - -/*! - \qmlmodule Qt.labs.wavefrontmesh 1.\QtMinorVersion - \title Qt Labs WavefrontMesh QML Types - \ingroup qmlmodules - \brief The WavefrontMesh provides a mesh based on a Wavefront .obj file. - - To use this module, import the module with the following line: - - \qml - import Qt.labs.wavefrontmesh - \endqml -*/ - -/*! - \qmltype WavefrontMesh - \inqmlmodule Qt.labs.wavefrontmesh - \instantiates QWavefrontMesh - \ingroup qtquick-effects - \brief The WavefrontMesh provides a mesh based on a Wavefront .obj file. - \since 5.12 - - WavefrontMesh reads the geometry from a Wavefront .obj file and generates - a two-dimensional \l{QSGGeometry}{geometry} from this. If the .obj file - contains a three-dimensional shape, it will be orthographically projected, - onto a plane. If defined, this is given by \l projectionPlaneV - and \l projectionPlaneW. Otherwise, the first face encountered in the data - will be used to determine the projection plane. - - If the file contains texture coordinates, these will also be used. Otherwise, - the vertexes of the object will be normalized and used. - - The mesh can be used in a ShaderEffect to define the shaded geometry. The - geometry will be normalized before use, so the position and scale of the - input objects have no impact on the result. - - \note Some Wavefront exporters will change the source scene's coordinate system - before exporting it. This can cause unexpected results when Qt applies the - projection. If the visual results are not as you expect, try checking the export - parameters and the documentation of the editor tool to see if this is the case. - - For instance, the following example takes an .obj file containing a standard torus - and visualizes the automatically generated texture coordinates. - - \table - \row - \li \image qtlabs-wavefrontmesh.png - \li \qml - import QtQuick 2.\1 - import Qt.labs.wavefrontmesh 1.\1 - - ShaderEffect { - width: 200 - height: 200 - mesh: WavefrontMesh { - source: "torus.obj" - projectionPlaneV: Qt.vector3d(0, 1, 0) - projectionPlaneW: Qt.vector3d(1, 0, 0) - } - vertexShader: " - uniform highp mat4 qt_Matrix; - attribute highp vec4 qt_Vertex; - attribute highp vec2 qt_MultiTexCoord0; - varying highp vec2 coord; - void main() { - coord = qt_MultiTexCoord0; - gl_Position = qt_Matrix * qt_Vertex; - }" - fragmentShader: " - varying highp vec2 coord; - uniform lowp float qt_Opacity; - void main() { - gl_FragColor = vec4(coord.x, coord.y, 0.0, 1.0); - }" - - } - \endqml - \endtable - - \note Since the input is a 3D torus, we need to define the projection plane. This would not be necessary when - using a 2D shape as input. We use the XY plane in this case, because of the orientation of the input. -*/ - -QWavefrontMesh::QWavefrontMesh(QObject *parent) - : QQuickShaderEffectMesh(*(new QWavefrontMeshPrivate), parent) -{ - connect(this, &QWavefrontMesh::sourceChanged, this, &QWavefrontMesh::readData); - connect(this, &QWavefrontMesh::projectionPlaneVChanged, this, &QQuickShaderEffectMesh::geometryChanged); - connect(this, &QWavefrontMesh::projectionPlaneWChanged, this, &QQuickShaderEffectMesh::geometryChanged); -} - -QWavefrontMesh::~QWavefrontMesh() -{ -} - -/*! - \qmlproperty enumeration WavefrontMesh::lastError - - This property holds the last error, if any, that occurred when parsing the - source or building the mesh. - - \list - \li WavefrontMesh.NoError No error has occurred. - \li WavefrontMesh.InvalidSourceError The source was not recognized as a valid .obj file. - \li WavefrontMesh.UnsupportedFaceShapeError The faces in the source is of an unsupported type. - WavefrontMesh only supports triangles and convex quads. - \li WavefrontMesh.UnsupportedIndexSizeError The source shape is too large. Only 16 bit indexes are supported. - \li WavefrontMesh.FileNotFoundError The source file was not found. - \li WavefrontMesh.MissingPositionAttributeError The 'qt_Vertex' attribute is missing from the shaders. - \li WavefrontMesh.MissingTextureCoordinateAttributeError The texture coordinate attribute in the shaders is wrongly named. Use 'qt_MultiTexCoord0'. - \li WavefrontMesh.MissingPositionAndTextureCoordinateAttributesError Both the 'qt_Vertex' and 'qt_MultiTexCoord0' attributes are missing from the shaders. - \li WavefrontMesh.TooManyAttributesError The shaders expect too many attributes (maximum is two: Position, 'qt_Vertex', and texture coordinate, 'qt_MultiTexCoord0'). - \li WavefrontMesh.InvalidPlaneDefinitionError The V and W vectors in the plane cannot be null, nor parallel to each other. - \endlist -*/ - -QWavefrontMesh::Error QWavefrontMesh::lastError() const -{ - Q_D(const QWavefrontMesh); - return d->lastError; -} - -void QWavefrontMesh::setLastError(Error lastError) -{ - Q_D(QWavefrontMesh); - if (d->lastError == lastError) - return; - - d->lastError = lastError; - emit lastErrorChanged(); -} - -/*! - \qmlproperty url WavefrontMesh::source - - This property holds the URL of the source. This must be either a local file or in qrc. The source will - be read as a Wavefront .obj file and the geometry will be updated. -*/ -QUrl QWavefrontMesh::source() const -{ - Q_D(const QWavefrontMesh); - return d->source; -} - -void QWavefrontMesh::setSource(const QUrl &source) -{ - Q_D(QWavefrontMesh); - if (d->source == source) - return; - - d->source = source; - emit sourceChanged(); -} - -void QWavefrontMesh::readData() -{ - Q_D(QWavefrontMesh); - d->vertexes.clear(); - d->textureCoordinates.clear(); - d->indexes.clear(); - - QString localFile = QQmlFile::urlToLocalFileOrQrc(d->source); - if (!localFile.isEmpty()) { - QFile file(localFile); - if (file.open(QIODevice::ReadOnly)) { - QTextStream stream(&file); - - QString buffer; - buffer.reserve(256); - - static QChar space(QLatin1Char(' ')); - static QChar slash(QLatin1Char('/')); - - while (!stream.atEnd()) { - stream.readLineInto(&buffer); - auto tokens = QStringView{buffer}.split(space, Qt::SkipEmptyParts); - if (tokens.size() < 2) - continue; - - QByteArray command = tokens.at(0).toLatin1(); - - if (command == "vt") { - bool ok; - float u = tokens.at(1).toFloat(&ok); - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - float v = tokens.size() > 2 ? tokens.at(2).toFloat(&ok) : 0.0; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - d->textureCoordinates.append(QVector2D(u, v)); - } else if (command == "v") { - // Format: v <x> <y> <z> [w] - if (tokens.length() < 4 || tokens.length() > 5) { - setLastError(InvalidSourceError); - return; - } - - bool ok; - - float x = tokens.at(1).toFloat(&ok); - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - float y = tokens.at(2).toFloat(&ok); - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - float z = tokens.at(3).toFloat(&ok); - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - d->vertexes.append(QVector3D(x, y, z)); - } else if (command == "f") { - // The scenegraph only supports triangles, so we - // support triangles and quads (which we split up) - int p1, p2, p3; - int t1 = 0; - int t2 = 0; - int t3 = 0; - if (tokens.size() >= 4 && tokens.size() <= 5) { - { - bool ok; - auto faceTokens = tokens.at(1).split(slash, Qt::SkipEmptyParts); - Q_ASSERT(!faceTokens.isEmpty()); - - p1 = faceTokens.at(0).toInt(&ok) - 1; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - if (faceTokens.size() > 1) { - t1 = faceTokens.at(1).toInt(&ok) - 1; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - } - } - - { - bool ok; - auto faceTokens = tokens.at(2).split(slash, Qt::SkipEmptyParts); - Q_ASSERT(!faceTokens.isEmpty()); - - p2 = faceTokens.at(0).toInt(&ok) - 1; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - if (faceTokens.size() > 1) { - t2 = faceTokens.at(1).toInt(&ok) - 1; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - } - } - - { - bool ok; - auto faceTokens = tokens.at(3).split(slash, Qt::SkipEmptyParts); - Q_ASSERT(!faceTokens.isEmpty()); - - p3 = faceTokens.at(0).toInt(&ok) - 1; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - if (faceTokens.size() > 1) { - t3 = faceTokens.at(1).toInt(&ok) - 1; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - } - } - - if (Q_UNLIKELY(p1 < 0 || p1 > UINT16_MAX - || p2 < 0 || p2 > UINT16_MAX - || p3 < 0 || p3 > UINT16_MAX - || t1 < 0 || t1 > UINT16_MAX - || t2 < 0 || t2 > UINT16_MAX - || t3 < 0 || t3 > UINT16_MAX)) { - setLastError(UnsupportedIndexSizeError); - return; - } - - d->indexes.append(qMakePair(ushort(p1), ushort(t1))); - d->indexes.append(qMakePair(ushort(p2), ushort(t2))); - d->indexes.append(qMakePair(ushort(p3), ushort(t3))); - } else { - setLastError(UnsupportedFaceShapeError); - return; - } - - if (tokens.size() == 5) { - bool ok; - auto faceTokens = tokens.at(4).split(slash, Qt::SkipEmptyParts); - Q_ASSERT(!faceTokens.isEmpty()); - - int p4 = faceTokens.at(0).toInt(&ok) - 1; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - - int t4 = 0; - if (faceTokens.size() > 1) { - t4 = faceTokens.at(1).toInt(&ok) - 1; - if (!ok) { - setLastError(InvalidSourceError); - return; - } - } - - if (Q_UNLIKELY(p4 < 0 || p4 > UINT16_MAX || t4 < 0 || t4 > UINT16_MAX)) { - setLastError(UnsupportedIndexSizeError); - return; - } - - // ### Assumes convex quad, correct algorithm is to find the concave corner, - // and if there is one, do the split on the line between this and the corner it is - // not connected to. Also assumes order of vertices is counter clockwise. - d->indexes.append(qMakePair(ushort(p3), ushort(t3))); - d->indexes.append(qMakePair(ushort(p4), ushort(t4))); - d->indexes.append(qMakePair(ushort(p1), ushort(t1))); - } - } - } - } else { - setLastError(FileNotFoundError); - } - } else { - setLastError(InvalidSourceError); - } - - emit geometryChanged(); -} - -QString QWavefrontMesh::log() const -{ - Q_D(const QWavefrontMesh); - switch (d->lastError) { - case NoError: return QStringLiteral("No error"); - case InvalidSourceError: return QStringLiteral("Error: Invalid source"); - case UnsupportedFaceShapeError: return QStringLiteral("Error: Unsupported face shape in source"); - case UnsupportedIndexSizeError: return QStringLiteral("Error: Unsupported index size in source"); - case FileNotFoundError: return QStringLiteral("Error: File not found"); - case MissingPositionAttributeError: return QStringLiteral("Error: Missing '%1' attribute").arg(qtPositionAttributeName()); - case MissingTextureCoordinateAttributeError: return QStringLiteral("Error: Missing '%1' attribute").arg(qtTexCoordAttributeName()); - case MissingPositionAndTextureCoordinateAttributesError: return QStringLiteral("Error: Missing '%1' and '%2' attributes").arg(qtPositionAttributeName()).arg(qtTexCoordAttributeName()); - case TooManyAttributesError: return QStringLiteral("Error: Too many attributes"); - case InvalidPlaneDefinitionError: return QStringLiteral("Error: Invalid plane. V and W must be non-null and cannot be parallel"); - default: return QStringLiteral("Unknown error"); - }; -} - -bool QWavefrontMesh::validateAttributes(const QList<QByteArray> &attributes, int *posIndex) -{ - Q_D(QWavefrontMesh); - const int attrCount = attributes.count(); - int positionIndex = attributes.indexOf(qtPositionAttributeName()); - int texCoordIndex = attributes.indexOf(qtTexCoordAttributeName()); - - switch (attrCount) { - case 0: - d->lastError = NoAttributesError; - return false; - case 1: - if (positionIndex < 0) { - d->lastError = MissingPositionAttributeError; - return false; - } - break; - case 2: - if (positionIndex < 0 || texCoordIndex < 0) { - if (positionIndex < 0 && texCoordIndex < 0) - d->lastError = MissingPositionAndTextureCoordinateAttributesError; - else if (positionIndex < 0) - d->lastError = MissingPositionAttributeError; - else if (texCoordIndex < 0) - d->lastError = MissingTextureCoordinateAttributeError; - return false; - } - break; - default: - d->lastError = TooManyAttributesError; - return false; - } - - if (posIndex) - *posIndex = positionIndex; - - return true; - -} - -QSGGeometry *QWavefrontMesh::updateGeometry(QSGGeometry *geometry, int attributeCount, int positionIndex, - const QRectF &sourceRect, const QRectF &destinationRect) -{ - Q_D(QWavefrontMesh); - - if (geometry == nullptr) { - Q_ASSERT(attributeCount == 1 || attributeCount == 2); - geometry = new QSGGeometry(attributeCount == 1 - ? QSGGeometry::defaultAttributes_Point2D() - : QSGGeometry::defaultAttributes_TexturedPoint2D(), - d->indexes.size(), - d->indexes.size(), - QSGGeometry::UnsignedShortType); - geometry->setDrawingMode(QSGGeometry::DrawTriangles); - - } else { - geometry->allocate(d->indexes.size(), d->indexes.size()); - } - - // If there is not at least a full triangle in the data set, skip out - if (d->indexes.size() < 3) { - geometry->allocate(0, 0); - return geometry; - } - - QVector3D planeV = d->planeV; - QVector3D planeW = d->planeW; - - // Automatically detect plane based on first face if none is set - if (planeV.isNull() || planeW.isNull()) { - QVector3D p = d->vertexes.at(d->indexes.at(0).first); - planeV = (d->vertexes.at(d->indexes.at(1).first) - p); - planeW = (p - d->vertexes.at(d->indexes.at(2).first)).normalized(); - } - - planeV.normalize(); - planeW.normalize(); - - QVector3D planeNormal = QVector3D::crossProduct(planeV, planeW).normalized(); - if (planeNormal.isNull()) { // V and W are either parallel or null - setLastError(InvalidPlaneDefinitionError); - geometry->allocate(0, 0); - return geometry; - } - - QVector3D planeAxes1 = planeV; - QVector3D planeAxes2 = QVector3D::crossProduct(planeAxes1, planeNormal).normalized(); - - ushort *indexData = static_cast<ushort *>(geometry->indexData()); - QSGGeometry::Point2D *vertexData = static_cast<QSGGeometry::Point2D *>(geometry->vertexData()); - - float minX = 0.0f; - float maxX = 0.0f; - float minY = 0.0f; - float maxY = 0.0f; - for (ushort i = 0; i < ushort(d->indexes.size()); ++i) { - *(indexData + i) = i; - - QVector3D v = d->vertexes.at(d->indexes.at(i).first); - - // Project onto plane - QVector2D w; - v -= QVector3D::dotProduct(planeNormal, v) * planeNormal; - w.setX(QVector3D::dotProduct(v, planeAxes1)); - w.setY(QVector3D::dotProduct(v, planeAxes2)); - - QSGGeometry::Point2D *positionData = vertexData + (i * attributeCount + positionIndex); - positionData->x = w.x(); - positionData->y = w.y(); - - if (i == 0 || minX > w.x()) - minX = w.x(); - if (i == 0 || maxX < w.x()) - maxX = w.x(); - if (i == 0 || minY > w.y()) - minY = w.y(); - if (i == 0 || maxY < w.y()) - maxY = w.y(); - - if (attributeCount > 1 && !d->textureCoordinates.isEmpty()) { - Q_ASSERT(positionIndex == 0 || positionIndex == 1); - - QVector2D uv = d->textureCoordinates.at(d->indexes.at(i).second); - QSGGeometry::Point2D *textureCoordinateData = vertexData + (i * attributeCount + (1 - positionIndex)); - textureCoordinateData->x = uv.x(); - textureCoordinateData->y = uv.y(); - } - } - - float width = maxX - minX; - float height = maxY - minY; - - QVector2D center(minX + width / 2.0f, minY + height / 2.0f); - QVector2D scale(1.0f / width, 1.0f / height); - - for (int i = 0; i < geometry->vertexCount(); ++i) { - float x = ((vertexData + positionIndex)->x - center.x()) * scale.x(); - float y = ((vertexData + positionIndex)->y - center.y()) * scale.y(); - - for (int attributeIndex = 0; attributeIndex < attributeCount; ++attributeIndex) { - if (attributeIndex == positionIndex) { - vertexData->x = float(destinationRect.left()) + x * float(destinationRect.width()) + float(destinationRect.width()) / 2.0f; - vertexData->y = float(destinationRect.top()) + y * float(destinationRect.height()) + float(destinationRect.height()) / 2.0f; - } else { - // If there are no texture coordinates, use the normalized vertex - float tx = d->textureCoordinates.isEmpty() ? x : vertexData->x; - float ty = d->textureCoordinates.isEmpty() ? y : vertexData->y; - - vertexData->x = float(sourceRect.left()) + tx * float(sourceRect.width()); - vertexData->y = float(sourceRect.top()) + ty * float(sourceRect.height()); - } - - ++vertexData; - } - } - - return geometry; -} - -/*! - \qmlproperty vector3d WavefrontMesh::projectionPlaneV - - Since the Wavefront .obj format describes an object in 3D space, the coordinates - have to be projected into 2D before they can be displayed in Qt Quick. - - This will be done in WavefrontMesh by an orthographic projection onto an - appropriate plane. - - The projectionPlaneV is one of two vectors in the plane in 3D space. If - either this, or \l projectionPlaneW is set to (0, 0, 0) (the default), - then the plane will be detected based on the first encountered face in the - data set. - - \note projectionPlaneV and \l projectionPlaneW cannot be parallel vectors. -*/ -void QWavefrontMesh::setProjectionPlaneV(const QVector3D &v) -{ - Q_D(QWavefrontMesh); - if (d->planeV == v) - return; - - d->planeV = v; - emit projectionPlaneVChanged(); -} - -QVector3D QWavefrontMesh::projectionPlaneV() const -{ - Q_D(const QWavefrontMesh); - return d->planeV; -} - -/*! - \qmlproperty vector3d WavefrontMesh::projectionPlaneW - - Since the Wavefront .obj format describes an object in 3D space, the coordinates - have to be projected into 2D before they can be displayed in Qt Quick. - - This will be done in WavefrontMesh by an orthographic projection onto an - appropriate plane. - - The projectionPlaneW is one of two vectors in the plane in 3D space. If - either this, or \l projectionPlaneV is set to (0, 0, 0) (the default), - then the plane will be detected based on the first encountered face in the - data set. - - \note \l projectionPlaneV and projectionPlaneW cannot be parallel vectors. -*/ -void QWavefrontMesh::setProjectionPlaneW(const QVector3D &w) -{ - Q_D(QWavefrontMesh); - if (d->planeW == w) - return; - - d->planeW = w; - emit projectionPlaneWChanged(); -} - -QVector3D QWavefrontMesh::projectionPlaneW() const -{ - Q_D(const QWavefrontMesh); - return d->planeW; -} - - -QT_END_NAMESPACE diff --git a/src/imports/wavefrontmesh/qwavefrontmesh.h b/src/imports/wavefrontmesh/qwavefrontmesh.h deleted file mode 100644 index adcf9d6052..0000000000 --- a/src/imports/wavefrontmesh/qwavefrontmesh.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWAVEFRONTMESH_H -#define QWAVEFRONTMESH_H - -#include <QtQuick/private/qquickshadereffectmesh_p.h> - -#include <QtCore/qurl.h> -#include <QtGui/qvector3d.h> - -QT_BEGIN_NAMESPACE - -class QWavefrontMeshPrivate; -class QWavefrontMesh : public QQuickShaderEffectMesh -{ - Q_OBJECT - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) - Q_PROPERTY(Error lastError READ lastError NOTIFY lastErrorChanged) - Q_PROPERTY(QVector3D projectionPlaneV READ projectionPlaneV WRITE setProjectionPlaneV NOTIFY projectionPlaneVChanged) - Q_PROPERTY(QVector3D projectionPlaneW READ projectionPlaneW WRITE setProjectionPlaneW NOTIFY projectionPlaneWChanged) - QML_NAMED_ELEMENT(WavefrontMesh) - QML_ADDED_IN_VERSION(1, 0) - -public: - enum Error { - NoError, - InvalidSourceError, - UnsupportedFaceShapeError, - UnsupportedIndexSizeError, - FileNotFoundError, - NoAttributesError, - MissingPositionAttributeError, - MissingTextureCoordinateAttributeError, - MissingPositionAndTextureCoordinateAttributesError, - TooManyAttributesError, - InvalidPlaneDefinitionError - }; - Q_ENUMS(Error) - - QWavefrontMesh(QObject *parent = nullptr); - ~QWavefrontMesh() override; - - QUrl source() const; - void setSource(const QUrl &url); - - Error lastError() const; - void setLastError(Error lastError); - - bool validateAttributes(const QList<QByteArray> &attributes, int *posIndex) override; - QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex, - const QRectF &srcRect, const QRectF &rect) override; - QString log() const override; - - QVector3D projectionPlaneV() const; - void setProjectionPlaneV(const QVector3D &projectionPlaneV); - - QVector3D projectionPlaneW() const; - void setProjectionPlaneW(const QVector3D &projectionPlaneW); - -Q_SIGNALS: - void sourceChanged(); - void lastErrorChanged(); - void projectionPlaneVChanged(); - void projectionPlaneWChanged(); - -protected Q_SLOTS: - void readData(); - -private: - Q_DISABLE_COPY(QWavefrontMesh) - Q_DECLARE_PRIVATE(QWavefrontMesh) -}; - -QT_END_NAMESPACE - -#endif // QWAVEFRONTGEOMETRYMODEL_H diff --git a/src/imports/window/CMakeLists.txt b/src/imports/window/CMakeLists.txt deleted file mode 100644 index 1f02b1a380..0000000000 --- a/src/imports/window/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# special case skip regeneration - -qt_internal_add_qml_module(quickwindow - URI "QtQuick.Window" - VERSION "${CMAKE_PROJECT_VERSION}" - IMPORTS - QtQuick/auto - PAST_MAJOR_VERSIONS 2 - GENERATE_QMLTYPES - INSTALL_QMLTYPES -) diff --git a/src/imports/workerscript/.prev_CMakeLists.txt b/src/imports/workerscript/.prev_CMakeLists.txt deleted file mode 100644 index 2d437a04da..0000000000 --- a/src/imports/workerscript/.prev_CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from workerscript.pro. - -##################################################################### -## workerscriptplugin Plugin: -##################################################################### - -qt_add_qml_module(workerscriptplugin - URI "QtQml.WorkerScript" - VERSION "${CMAKE_PROJECT_VERSION}" - DESIGNER_SUPPORTED - CLASSNAME QtQmlWorkerScriptPlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::QmlPrivate - Qt::QmlWorkerScriptPrivate -) - -#### Keys ignored in scope 1:.:.:workerscript.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQml/WorkerScript" diff --git a/src/imports/workerscript/CMakeLists.txt b/src/imports/workerscript/CMakeLists.txt deleted file mode 100644 index b2a6d0f444..0000000000 --- a/src/imports/workerscript/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Generated from workerscript.pro. - -##################################################################### -## workerscriptplugin Plugin: -##################################################################### - -qt_internal_add_qml_module(workerscriptplugin - URI "QtQml.WorkerScript" - VERSION "${CMAKE_PROJECT_VERSION}" - DESIGNER_SUPPORTED - CLASSNAME QtQmlWorkerScriptPlugin - SKIP_TYPE_REGISTRATION - PLUGIN_OPTIONAL - SOURCES - plugin.cpp - PUBLIC_LIBRARIES - Qt::QmlPrivate - Qt::QmlWorkerScriptPrivate -) - -#### Keys ignored in scope 1:.:.:workerscript.pro:<TRUE>: -# CXX_MODULE = "qml" -# QML_IMPORT_VERSION = "$$QT_VERSION" -# TARGETPATH = "QtQml/WorkerScript" diff --git a/src/imports/workerscript/plugin.cpp b/src/imports/workerscript/plugin.cpp deleted file mode 100644 index 55b88cb9b7..0000000000 --- a/src/imports/workerscript/plugin.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** 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 Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtQmlWorkerScript/private/qtqmlworkerscriptglobal_p.h> -#include <QtQml/qqmlextensionplugin.h> - -QT_BEGIN_NAMESPACE - -/*! - \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 -*/ - -class QtQmlWorkerScriptPlugin : public QQmlEngineExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) -public: - QtQmlWorkerScriptPlugin(QObject *parent = nullptr) : QQmlEngineExtensionPlugin(parent) - { - volatile auto registration = &qml_register_types_QtQml_WorkerScript; - Q_UNUSED(registration); - } -}; - -QT_END_NAMESPACE - -#include "plugin.moc" |