diff options
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/localstorage/plugin.cpp | 1 | ||||
-rw-r--r-- | src/imports/qtqml/plugin.cpp | 91 | ||||
-rw-r--r-- | src/imports/qtqml/qmldir | 2 | ||||
-rw-r--r-- | src/imports/qtqml/qtqml.pro | 15 | ||||
-rw-r--r-- | src/imports/qtquick2/plugin.cpp | 9 | ||||
-rw-r--r-- | src/imports/sharedimage/qsharedimageloader.cpp | 2 | ||||
-rw-r--r-- | src/imports/statemachine/signaltransition.cpp | 1 | ||||
-rw-r--r-- | src/imports/testlib/main.cpp | 16 |
8 files changed, 116 insertions, 21 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 3c34d8e45a..0aad0d7c16 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -41,7 +41,6 @@ #include <QtQml/qqml.h> #include <private/qqmlengine_p.h> #include <QDebug> -#include <private/qv8engine_p.h> #include <QtSql/qsqldatabase.h> #include <QtSql/qsqlquery.h> #include <QtSql/qsqlerror.h> diff --git a/src/imports/qtqml/plugin.cpp b/src/imports/qtqml/plugin.cpp new file mode 100644 index 0000000000..eb8c0ffc2f --- /dev/null +++ b/src/imports/qtqml/plugin.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** 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/private/qqmlengine_p.h> +#include <QtQml/private/qqmlcomponentattached_p.h> +#include <QtQml/private/qqmlbind_p.h> + +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#include <QtQml/private/qqmlmodelsmodule_p.h> +#endif + +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 \QtMinorVersion + import QtQml 2.\1 + \endqml +*/ + +//![class decl] +class QtQmlPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) +public: + QtQmlPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { } + void registerTypes(const char *uri) override + { + Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQml")); + QQmlEnginePrivate::defineModule(); + +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QQmlModelsModule::registerQmlTypes(); +#endif + + // Auto-increment the import to stay in sync with ALL future QtQml minor versions from 5.11 onward + qmlRegisterModule(uri, 2, QT_VERSION_MINOR); + } +}; +//![class decl] + +QT_END_NAMESPACE + +#include "plugin.moc" diff --git a/src/imports/qtqml/qmldir b/src/imports/qtqml/qmldir index 8175ebb1a1..f6b51c7970 100644 --- a/src/imports/qtqml/qmldir +++ b/src/imports/qtqml/qmldir @@ -1,2 +1,4 @@ module QtQml +plugin qmlplugin +classname QtQmlPlugin typeinfo plugins.qmltypes diff --git a/src/imports/qtqml/qtqml.pro b/src/imports/qtqml/qtqml.pro index c00172ddc4..d5bb313d0c 100644 --- a/src/imports/qtqml/qtqml.pro +++ b/src/imports/qtqml/qtqml.pro @@ -1,12 +1,11 @@ TARGETPATH = QtQml -AUX_QML_FILES += plugins.qmltypes +CXX_MODULE = qml +TARGET = qmlplugin +IMPORT_VERSION = 2.$$QT_MINOR_VERSION -load(qml_module) +SOURCES += \ + plugin.cpp -# qmltypes target -!cross_compile:if(build_pass|!debug_and_release) { - qtPrepareTool(QMLPLUGINDUMP, qmlplugindump) +QT = qml-private - qmltypes.commands = $$QMLPLUGINDUMP -nonrelocatable -noforceqtquick QtQml 2.$$QT_MINOR_VERSION > $$PWD/plugins.qmltypes - QMAKE_EXTRA_TARGETS += qmltypes -} +load(qml_plugin) diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp index d73a8b3688..4dc6fee916 100644 --- a/src/imports/qtquick2/plugin.cpp +++ b/src/imports/qtquick2/plugin.cpp @@ -38,6 +38,8 @@ ****************************************************************************/ #include <QtQml/qqmlextensionplugin.h> +#include <QtQml/private/qqmlengine_p.h> +#include <QtQml/private/qqmlmodelsmodule_p.h> #include <private/qtquick2_p.h> @@ -55,7 +57,14 @@ public: Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick")); Q_UNUSED(uri); moduleDefined = true; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QQmlEnginePrivate::registerQuickTypes(); + QQmlModelsModule::registerQuickTypes(); +#endif QQmlQtQuick2Module::defineModule(); + + // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward + qmlRegisterModule("QtQuick", 2, QT_VERSION_MINOR); } ~QtQuick2Plugin() override diff --git a/src/imports/sharedimage/qsharedimageloader.cpp b/src/imports/sharedimage/qsharedimageloader.cpp index 4672ded376..c9e3ef3eb3 100644 --- a/src/imports/sharedimage/qsharedimageloader.cpp +++ b/src/imports/sharedimage/qsharedimageloader.cpp @@ -173,7 +173,7 @@ QImage QSharedImageLoaderPrivate::load(const QString &path, QSharedImageLoader:: if (img.isNull()) return nil; size_t size = sizeof(SharedImageHeader) + img.sizeInBytes(); - if (size > std::numeric_limits<int>::max()) { + if (size > size_t(std::numeric_limits<int>::max())) { qCDebug(lcSharedImage) << "Image" << path << "to large to load"; return nil; } else if (shm->create(int(size))) { diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp index d4ea25cc4b..52dffe9004 100644 --- a/src/imports/statemachine/signaltransition.cpp +++ b/src/imports/statemachine/signaltransition.cpp @@ -47,7 +47,6 @@ #include <QQmlExpression> #include <private/qv4qobjectwrapper_p.h> -#include <private/qv8engine_p.h> #include <private/qjsvalue_p.h> #include <private/qv4scopedvalue_p.h> #include <private/qqmlcontext_p.h> diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index c625c87db7..7b931c25d2 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -80,7 +80,7 @@ Q_SIGNALS: public Q_SLOTS: - QQmlV4Handle typeName(const QVariant& v) const + QJSValue typeName(const QVariant& v) const { QString name(v.typeName()); if (v.canConvert<QObject*>()) { @@ -97,27 +97,23 @@ public Q_SLOTS: QQmlEngine *engine = qmlEngine(this); QV4::ExecutionEngine *v4 = engine->handle(); - QV4::Scope scope(v4); - QV4::ScopedValue s(scope, v4->newString(name)); - return QQmlV4Handle(s); + return QJSValue(v4, v4->newString(name)->asReturnedValue()); } bool compare(const QVariant& act, const QVariant& exp) const { return act == exp; } - QQmlV4Handle callerFile(int frameIndex = 0) const + QJSValue callerFile(int frameIndex = 0) const { QQmlEngine *engine = qmlEngine(this); QV4::ExecutionEngine *v4 = engine->handle(); QV4::Scope scope(v4); QVector<QV4::StackFrame> stack = v4->stackTrace(frameIndex + 2); - if (stack.size() > frameIndex + 1) { - QV4::ScopedValue s(scope, v4->newString(stack.at(frameIndex + 1).source)); - return QQmlV4Handle(s); - } - return QQmlV4Handle(); + return (stack.size() > frameIndex + 1) + ? QJSValue(v4, v4->newString(stack.at(frameIndex + 1).source)->asReturnedValue()) + : QJSValue(); } int callerLine(int frameIndex = 0) const { |