aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-10-09 15:16:29 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-10-09 15:16:29 +0200
commit89139a0ba2a1a13659e6514dfa9b6614fce755d6 (patch)
treee9c79326ae388255ac623829b96436057773d7f8
parent5e0222a9e474d21a686fa253d7c1ad840e9ee274 (diff)
parent7cd9447e14159be90a5fdb927a4a3ed2cbff50b2 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
-rw-r--r--src/qml/compiler/qv4codegen_p.h4
-rw-r--r--src/qml/qml/qqmlmetatype.cpp7
-rw-r--r--src/qml/qml/qqmlmetatype_p.h2
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/CompositeSingleton/qmldir2
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.cpp39
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.h (renamed from tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.h)6
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.pro23
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy_plugin.cpp (renamed from tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.cpp)2
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy_plugin.h (renamed from tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.h)0
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Dummy/plugins.qmltypes17
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Dummy/qmldir3
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/extendedtype.pro22
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugin.cpp40
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugin.h43
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes35
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/qmldir3
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/types.h86
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Imports/CompositeImports.qml (renamed from tests/manual/qmlplugindump/tests/dumper/Imports/CompositeImports.qml)0
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.cpp39
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.h (renamed from tests/manual/qmlplugindump/tests/dumper/Imports/imports.h)6
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.pro24
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Imports/imports_plugin.cpp (renamed from tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.cpp)2
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Imports/imports_plugin.h (renamed from tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.h)0
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Imports/plugins.qmltypes17
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Imports/qmldir (renamed from tests/manual/qmlplugindump/tests/dumper/Imports/qmldir)2
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Singleton/CompositeSingleton.qml (renamed from tests/manual/qmlplugindump/tests/dumper/Singleton/CompositeSingleton.qml)0
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Singleton/qmldir (renamed from tests/manual/qmlplugindump/tests/dumper/Singleton/qmldir)2
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/plugin.qmltypes (renamed from tests/manual/qmlplugindump/tests/dumper/Versions/plugin.qmltypes)12
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes23
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/qmldir3
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.cpp39
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.h (renamed from tests/manual/qmlplugindump/tests/dumper/Versions/versions.h)6
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.pro (renamed from tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro)20
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/versions_plugin.cpp (renamed from tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.cpp)2
-rw-r--r--tests/auto/qml/qmlplugindump/data/dumper/Versions/versions_plugin.h (renamed from tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.h)0
-rw-r--r--tests/auto/qml/qmlplugindump/qmlplugindump.pro13
-rw-r--r--tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp39
-rw-r--r--tests/auto/qml/qmlplugindump/tst_qmlplugindump.pro9
-rw-r--r--tests/manual/qmlplugindump/README42
-rw-r--r--tests/manual/qmlplugindump/definitions/000_dummy.json5
-rw-r--r--tests/manual/qmlplugindump/definitions/001_versions.json8
-rw-r--r--tests/manual/qmlplugindump/definitions/002_revisions.json9
-rw-r--r--tests/manual/qmlplugindump/qmlplugindump.pro10
-rw-r--r--tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.cpp44
-rw-r--r--tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro33
-rw-r--r--tests/manual/qmlplugindump/tests/dumper/Dummy/qmldir3
-rw-r--r--tests/manual/qmlplugindump/tests/dumper/Imports/imports.cpp44
-rw-r--r--tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro33
-rw-r--r--tests/manual/qmlplugindump/tests/dumper/Versions/qmldir3
-rw-r--r--tests/manual/qmlplugindump/tests/dumper/Versions/versions.cpp44
-rw-r--r--tests/manual/qmlplugindump/tst_qmlplugindump.cpp371
-rw-r--r--tools/qmlplugindump/main.cpp181
52 files changed, 648 insertions, 774 deletions
diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h
index 49607256f9..e6e7d2e9fb 100644
--- a/src/qml/compiler/qv4codegen_p.h
+++ b/src/qml/compiler/qv4codegen_p.h
@@ -192,8 +192,8 @@ public:
bool isLValue() const { return !isReadonly && type > Accumulator; }
- Reference(Codegen *cg, Type type = Invalid) : type(type), codegen(cg) {}
- Reference() {}
+ Reference(Codegen *cg, Type type = Invalid) : type(type), constant(0), codegen(cg) {}
+ Reference(): constant(0) {}
Reference(const Reference &) = default;
Reference(Reference &&) = default;
Reference &operator =(const Reference &) = default;
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index e34f7a407f..ea4a69f05d 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -1080,6 +1080,13 @@ bool QQmlType::isCreatable() const
return d && d->regType == CppType && d->extraData.cd->newFunc;
}
+QQmlType::ExtensionFunc QQmlType::extensionFunction() const
+{
+ if (!d || d->regType != CppType)
+ return nullptr;
+ return d->extraData.cd->extFunc;
+}
+
bool QQmlType::isExtendedType() const
{
if (!d)
diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h
index 4a5e4ba266..b3ca6acd64 100644
--- a/src/qml/qml/qqmlmetatype_p.h
+++ b/src/qml/qml/qqmlmetatype_p.h
@@ -201,6 +201,8 @@ public:
QQmlCustomParser *customParser() const;
bool isCreatable() const;
+ typedef QObject *(*ExtensionFunc)(QObject *);
+ ExtensionFunc extensionFunction() const;
bool isExtendedType() const;
QString noCreationReason() const;
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/CompositeSingleton/qmldir b/tests/auto/qml/qmlplugindump/data/dumper/CompositeSingleton/qmldir
index 8df57f6d47..c08e74db2e 100644
--- a/tests/auto/qml/qmlplugindump/data/dumper/CompositeSingleton/qmldir
+++ b/tests/auto/qml/qmlplugindump/data/dumper/CompositeSingleton/qmldir
@@ -1,3 +1,3 @@
-module tests.dumper.CompositeSingleton
+module dumper.CompositeSingleton
singleton Singleton 1.0 Singleton.qml
depends QtQuick 2.0
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.cpp b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.cpp
new file mode 100644
index 0000000000..689ea4aa53
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.cpp
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "dummy.h"
+
+Dummy::Dummy(QObject *parent):
+ QObject(parent)
+{
+}
+
+Dummy::~Dummy()
+{
+}
+
diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.h b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.h
index 8cf645da24..7011f72523 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.h
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.h
@@ -29,14 +29,14 @@
#ifndef DUMMY_H
#define DUMMY_H
-#include <QQuickItem>
+#include <QObject>
-class Dummy : public QQuickItem
+class Dummy : public QObject
{
Q_OBJECT
public:
- Dummy(QQuickItem *parent = 0);
+ Dummy(QObject *parent = nullptr);
~Dummy();
};
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.pro b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.pro
new file mode 100644
index 0000000000..9f5bc927b4
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy.pro
@@ -0,0 +1,23 @@
+TEMPLATE = lib
+TARGET = Dummy
+QT += qml
+CONFIG += qt plugin
+
+CONFIG -= debug_and_release_target
+!build_pass:qtConfig(debug_and_release): CONFIG += release
+
+TARGET = $$qtLibraryTarget($$TARGET)
+
+SOURCES += \
+ dummy_plugin.cpp \
+ dummy.cpp
+
+HEADERS += \
+ dummy_plugin.h \
+ dummy.h
+
+!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
+ cp.files = qmldir plugins.qmltypes
+ cp.path = $$OUT_PWD
+ COPIES += cp
+}
diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.cpp b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy_plugin.cpp
index 7bd869fc34..763604daf0 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.cpp
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy_plugin.cpp
@@ -33,7 +33,7 @@
void DummyPlugin::registerTypes(const char *uri)
{
- // @uri tests.dumper.dummy
+ // @uri dumper.dummy
qmlRegisterType<Dummy>(uri, 1, 0, "Dummy");
}
diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.h b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy_plugin.h
index 86e80e6a08..86e80e6a08 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy_plugin.h
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/dummy_plugin.h
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Dummy/plugins.qmltypes b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/plugins.qmltypes
new file mode 100644
index 0000000000..da0f2f24e4
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/plugins.qmltypes
@@ -0,0 +1,17 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable -noforceqtquick dumper.Dummy 1.0 .'
+
+Module {
+ dependencies: []
+ Component {
+ name: "Dummy"
+ prototype: "QObject"
+ exports: ["dumper.Dummy/Dummy 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+}
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Dummy/qmldir b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/qmldir
new file mode 100644
index 0000000000..7d4107c040
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Dummy/qmldir
@@ -0,0 +1,3 @@
+module dumper.Dummy
+plugin Dummy
+
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/extendedtype.pro b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/extendedtype.pro
new file mode 100644
index 0000000000..24243aa622
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/extendedtype.pro
@@ -0,0 +1,22 @@
+TEMPLATE = lib
+TARGET = ExtendedType
+QT += qml
+CONFIG += qt plugin
+
+CONFIG -= debug_and_release_target
+!build_pass:qtConfig(debug_and_release): CONFIG += release
+
+TARGET = $$qtLibraryTarget($$TARGET)
+
+SOURCES += \
+ plugin.cpp
+
+HEADERS += \
+ plugin.h \
+ types.h
+
+!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
+ cp.files = qmldir plugins.qmltypes
+ cp.path = $$OUT_PWD
+ COPIES += cp
+}
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugin.cpp b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugin.cpp
new file mode 100644
index 0000000000..423fbc1f4c
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugin.cpp
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "plugin.h"
+#include "types.h"
+
+#include <qqml.h>
+
+void Plugin::registerTypes(const char *uri)
+{
+ // @uri dumper.ExtendedType
+ qmlRegisterType<Type>(uri, 1, 0, "Type");
+ qmlRegisterExtendedType<Type, ExtendedType>(uri, 1, 1, "Type");
+ qmlRegisterType<DerivedType2>(uri, 1, 1, "DerivedType");
+}
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugin.h b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugin.h
new file mode 100644
index 0000000000..b677fe2940
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugin.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PLUGIN_H
+#define PLUGIN_H
+
+#include <QQmlExtensionPlugin>
+
+class Plugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ void registerTypes(const char *uri);
+};
+
+#endif // PLUGIN_H
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes
new file mode 100644
index 0000000000..d84eb0011a
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/plugins.qmltypes
@@ -0,0 +1,35 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable -noforceqtquick dumper.ExtendedType 1.1 .'
+
+Module {
+ dependencies: []
+ Component {
+ name: "DerivedType1"
+ prototype: "Type"
+ Property { name: "m_exendedProperty2"; type: "int" }
+ }
+ Component {
+ name: "DerivedType2"
+ prototype: "DerivedType1"
+ exports: ["dumper.ExtendedType/DerivedType 1.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "Type"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: [
+ "dumper.ExtendedType/Type 1.0",
+ "dumper.ExtendedType/Type 1.1"
+ ]
+ exportMetaObjectRevisions: [0, 101]
+ Property { name: "baseProperty"; type: "int" }
+ Property { name: "extendedProperty"; revision: 101; type: "int" }
+ Property { name: "data"; revision: 101; type: "QObject"; isList: true; isReadonly: true }
+ }
+}
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/qmldir b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/qmldir
new file mode 100644
index 0000000000..6693f403d9
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/qmldir
@@ -0,0 +1,3 @@
+module dumper.ExtendedType
+plugin ExtendedType
+
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/types.h b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/types.h
new file mode 100644
index 0000000000..dfba55a094
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/ExtendedType/types.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TYPES_H
+#define TYPES_H
+
+#include <QObject>
+#include <QQmlListProperty>
+
+class Type : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int baseProperty MEMBER m_baseProperty)
+
+public:
+ Type(QObject *parent = nullptr)
+ : QObject(parent) {}
+
+private:
+ int m_baseProperty;
+};
+
+class ExtendedType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int extendedProperty MEMBER m_extendedProperty)
+ Q_PROPERTY(QQmlListProperty<QObject> data READ data)
+ Q_CLASSINFO("DefaultProperty", "data")
+
+public:
+ ExtendedType(QObject *parent = nullptr)
+ : QObject(parent) {}
+ QQmlListProperty<QObject> data() { return QQmlListProperty<QObject>(this, m_data); }
+
+private:
+ QList<QObject *> m_data;
+ int m_extendedProperty;
+};
+
+class DerivedType1 : public Type
+{
+ Q_OBJECT
+ Q_PROPERTY(int m_exendedProperty2 MEMBER m_extendedProperty2)
+
+public:
+ DerivedType1(QObject *parent = nullptr)
+ : Type(parent) {}
+
+private:
+ int m_extendedProperty2;
+};
+
+class DerivedType2 : public DerivedType1
+{
+ Q_OBJECT
+public:
+ DerivedType2(QObject *parent = nullptr)
+ : DerivedType1(parent) {}
+};
+
+#endif // TYPES_H
diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/CompositeImports.qml b/tests/auto/qml/qmlplugindump/data/dumper/Imports/CompositeImports.qml
index b1055b6992..b1055b6992 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Imports/CompositeImports.qml
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Imports/CompositeImports.qml
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.cpp b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.cpp
new file mode 100644
index 0000000000..a923fade2a
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.cpp
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "imports.h"
+
+Imports::Imports(QObject *parent):
+ QObject(parent)
+{
+}
+
+Imports::~Imports()
+{
+}
+
diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.h b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.h
index 3854a042d2..d2b9036e4d 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.h
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.h
@@ -29,14 +29,14 @@
#ifndef IMPORTS_H
#define IMPORTS_H
-#include <QQuickItem>
+#include <QObject>
-class Imports : public QQuickItem
+class Imports : public QObject
{
Q_OBJECT
public:
- Imports(QQuickItem *parent = 0);
+ Imports(QObject *parent = nullptr);
~Imports();
};
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.pro b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.pro
new file mode 100644
index 0000000000..d20ea967ea
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports.pro
@@ -0,0 +1,24 @@
+TEMPLATE = lib
+TARGET = Imports
+QT += qml
+CONFIG += qt plugin
+
+CONFIG -= debug_and_release_target
+!build_pass:qtConfig(debug_and_release): CONFIG += release
+
+TARGET = $$qtLibraryTarget($$TARGET)
+
+SOURCES += \
+ imports_plugin.cpp \
+ imports.cpp
+
+HEADERS += \
+ imports_plugin.h \
+ imports.h
+
+!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
+ cp.files = qmldir plugins.qmltypes CompositeImports.qml
+ cp.path = $$OUT_PWD
+ COPIES += cp
+}
+
diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.cpp b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports_plugin.cpp
index ec6e56ca33..183ba56ac1 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.cpp
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports_plugin.cpp
@@ -33,7 +33,7 @@
void ImportsPlugin::registerTypes(const char *uri)
{
- // @uri tests.dumper.imports
+ // @uri dumper.imports
qmlRegisterType<Imports>(uri, 1, 0, "Imports");
}
diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.h b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports_plugin.h
index fd09584d47..fd09584d47 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Imports/imports_plugin.h
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Imports/imports_plugin.h
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Imports/plugins.qmltypes b/tests/auto/qml/qmlplugindump/data/dumper/Imports/plugins.qmltypes
new file mode 100644
index 0000000000..937dd60a9e
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Imports/plugins.qmltypes
@@ -0,0 +1,17 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable -noforceqtquick dumper.Imports 1.0 .'
+
+Module {
+ dependencies: ["QtQuick 2.0"]
+ Component {
+ name: "Imports"
+ prototype: "QObject"
+ exports: ["dumper.Imports/Imports 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+}
diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/qmldir b/tests/auto/qml/qmlplugindump/data/dumper/Imports/qmldir
index efab493dc8..c9058a7f95 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Imports/qmldir
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Imports/qmldir
@@ -1,3 +1,3 @@
-module tests.dumper.Imports
+module dumper.Imports
plugin Imports
CompositeImports 1.0 CompositeImports.qml
diff --git a/tests/manual/qmlplugindump/tests/dumper/Singleton/CompositeSingleton.qml b/tests/auto/qml/qmlplugindump/data/dumper/Singleton/CompositeSingleton.qml
index b47d2e98f4..b47d2e98f4 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Singleton/CompositeSingleton.qml
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Singleton/CompositeSingleton.qml
diff --git a/tests/manual/qmlplugindump/tests/dumper/Singleton/qmldir b/tests/auto/qml/qmlplugindump/data/dumper/Singleton/qmldir
index dec4063fda..6ed6d6f1d4 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Singleton/qmldir
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Singleton/qmldir
@@ -1,2 +1,2 @@
-module tests.dumper.Singleton
+module dumper.Singleton
singleton CompositeSingleton 1.0 CompositeSingleton.qml
diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/plugin.qmltypes b/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugin.qmltypes
index 0e09c2cfc7..3a33590139 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Versions/plugin.qmltypes
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugin.qmltypes
@@ -4,15 +4,17 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump tests.dumper.versions 1.1 .'
+// 'qmlplugindump -nonrelocatable -noforceqtquick dumper.Versions 1.1 .'
Module {
- dependencies: ["QtQuick 2.0"]
+ dependencies: []
Component {
name: "Versions"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["Versions 1.0", "Versions 1.1"]
+ prototype: "QObject"
+ exports: [
+ "dumper.Versions/Versions 1.0",
+ "dumper.Versions/Versions 1.1"
+ ]
exportMetaObjectRevisions: [0, 1]
Property { name: "foo"; type: "int" }
Property { name: "bar"; revision: 1; type: "int" }
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes b/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes
new file mode 100644
index 0000000000..3a33590139
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/plugins.qmltypes
@@ -0,0 +1,23 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable -noforceqtquick dumper.Versions 1.1 .'
+
+Module {
+ dependencies: []
+ Component {
+ name: "Versions"
+ prototype: "QObject"
+ exports: [
+ "dumper.Versions/Versions 1.0",
+ "dumper.Versions/Versions 1.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
+ Property { name: "foo"; type: "int" }
+ Property { name: "bar"; revision: 1; type: "int" }
+ Property { name: "baz"; revision: 2; type: "int" }
+ }
+}
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Versions/qmldir b/tests/auto/qml/qmlplugindump/data/dumper/Versions/qmldir
new file mode 100644
index 0000000000..a47a2a4573
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/qmldir
@@ -0,0 +1,3 @@
+module dumper.Versions
+plugin Versions
+
diff --git a/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.cpp b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.cpp
new file mode 100644
index 0000000000..3422275d78
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.cpp
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** 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:GPL-EXCEPT$
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** 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-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "versions.h"
+
+Versions::Versions(QObject *parent):
+ QObject(parent)
+{
+}
+
+Versions::~Versions()
+{
+}
+
diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.h b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.h
index 56403d90a7..ba88f478ca 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.h
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.h
@@ -29,9 +29,9 @@
#ifndef VERSIONS_H
#define VERSIONS_H
-#include <QQuickItem>
+#include <QObject>
-class Versions : public QQuickItem
+class Versions : public QObject
{
Q_OBJECT
Q_PROPERTY(int foo READ foo WRITE setFoo NOTIFY fooChanged)
@@ -39,7 +39,7 @@ class Versions : public QQuickItem
Q_PROPERTY(int baz READ baz WRITE setBaz NOTIFY bazChanged REVISION 2)
public:
- Versions(QQuickItem *parent = 0);
+ Versions(QObject *parent = nullptr);
~Versions();
int foo() const { return m_foo; }
void setFoo(int value) { m_foo = value; }
diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.pro
index d59470862d..6bbb9e556b 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.pro
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions.pro
@@ -1,12 +1,13 @@
TEMPLATE = lib
TARGET = Versions
-QT += qml quick
+QT += qml
CONFIG += qt plugin
+CONFIG -= debug_and_release_target
+!build_pass:qtConfig(debug_and_release): CONFIG += release
+
TARGET = $$qtLibraryTarget($$TARGET)
-uri = tests.dumper.Versions
-# Input
SOURCES += \
versions_plugin.cpp \
versions.cpp
@@ -15,19 +16,8 @@ HEADERS += \
versions_plugin.h \
versions.h
-DISTFILES = qmldir
-
!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
- cpqmldir.files = qmldir
+ cpqmldir.files = qmldir plugins.qmltypes
cpqmldir.path = $$OUT_PWD
COPIES += cpqmldir
}
-
-qmldir.files = qmldir
-unix {
- installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
- qmldir.path = $$installPath
- target.path = $$installPath
- INSTALLS += target qmldir
-}
-
diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.cpp b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions_plugin.cpp
index 59741f96a3..4bd290aff1 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.cpp
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions_plugin.cpp
@@ -33,7 +33,7 @@
void VersionsPlugin::registerTypes(const char *uri)
{
- // @uri tests.dumper.versions
+ // @uri dumper.versions
qmlRegisterType<Versions>(uri, 1, 0, "Versions");
qmlRegisterType<Versions, 1>(uri, 1, 1, "Versions");
}
diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.h b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions_plugin.h
index 4ba68a8125..4ba68a8125 100644
--- a/tests/manual/qmlplugindump/tests/dumper/Versions/versions_plugin.h
+++ b/tests/auto/qml/qmlplugindump/data/dumper/Versions/versions_plugin.h
diff --git a/tests/auto/qml/qmlplugindump/qmlplugindump.pro b/tests/auto/qml/qmlplugindump/qmlplugindump.pro
index ab915c819c..34eb58c981 100644
--- a/tests/auto/qml/qmlplugindump/qmlplugindump.pro
+++ b/tests/auto/qml/qmlplugindump/qmlplugindump.pro
@@ -1,7 +1,8 @@
-QT += testlib gui-private qml
-macx:CONFIG -= app_bundle
+TEMPLATE = subdirs
-include(../../shared/util.pri)
-
-DEFINES += QT_QMLTEST_DIR=\\\"$${_PRO_FILE_PWD_}\\\"
-SOURCES += tst_qmlplugindump.cpp
+SUBDIRS += \
+ tst_qmlplugindump.pro \
+ data/dumper/Dummy/dummy.pro \
+ data/dumper/Imports/imports.pro \
+ data/dumper/Versions/versions.pro \
+ data/dumper/ExtendedType/extendedtype.pro
diff --git a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
index ffddc52f9c..f673fca1d7 100644
--- a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
+++ b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
@@ -45,6 +45,8 @@ private slots:
void initTestCase();
void builtins();
void singleton();
+ void plugin_data();
+ void plugin();
private:
QString qmlplugindumpPath;
@@ -105,8 +107,8 @@ void tst_qmlplugindump::singleton()
{
QProcess dumper;
QStringList args;
- args << QLatin1String("tests.dumper.CompositeSingleton") << QLatin1String("1.0")
- << QLatin1String(QT_QMLTEST_DIR);
+ args << QLatin1String("dumper.CompositeSingleton") << QLatin1String("1.0")
+ << QLatin1String(QT_QMLTEST_DIR "/data");
dumper.start(qmlplugindumpPath, args);
QVERIFY2(dumper.waitForStarted(), qPrintable(dumper.errorString()));
QVERIFY2(dumper.waitForFinished(), qPrintable(dumper.errorString()));
@@ -116,6 +118,39 @@ void tst_qmlplugindump::singleton()
QVERIFY2(result.contains(QLatin1String("exportMetaObjectRevisions: [0]")), qPrintable(result));
}
+void tst_qmlplugindump::plugin_data()
+{
+ QTest::addColumn<QString>("import");
+ QTest::addColumn<QString>("version");
+ QTest::addColumn<QString>("expectedPath");
+
+ QTest::newRow("dumper.Dummy") << "dumper.Dummy" << "1.0" << testFile("dumper/Dummy/plugins.qmltypes");
+ QTest::newRow("dumper.Imports") << "dumper.Imports" << "1.0" << testFile("dumper/Imports/plugins.qmltypes");
+ QTest::newRow("dumper.Versions") << "dumper.Versions" << "1.1" << testFile("dumper/Versions/plugins.qmltypes");
+ QTest::newRow("dumper.ExtendedType") << "dumper.ExtendedType"
+ << "1.1" << testFile("dumper/ExtendedType/plugins.qmltypes");
+}
+
+void tst_qmlplugindump::plugin()
+{
+ QFETCH(QString, import);
+ QFETCH(QString, version);
+ QFETCH(QString, expectedPath);
+
+ QProcess dumper;
+ dumper.setWorkingDirectory(dataDirectory());
+ QStringList args = { QLatin1String("-nonrelocatable"), QLatin1String("-noforceqtquick"), import, version, QLatin1String(".") };
+ dumper.start(qmlplugindumpPath, args);
+ QVERIFY2(dumper.waitForStarted(), qPrintable(dumper.errorString()));
+ QVERIFY2(dumper.waitForFinished(), qPrintable(dumper.errorString()));
+
+ const QString &result = dumper.readAllStandardOutput();
+ QFile expectedFile(expectedPath);
+ QVERIFY2(expectedFile.open(QIODevice::ReadOnly), qPrintable(expectedFile.errorString()));
+ const QString expected = expectedFile.readAll();
+ QCOMPARE(result, expected);
+}
+
QTEST_MAIN(tst_qmlplugindump)
#include "tst_qmlplugindump.moc"
diff --git a/tests/auto/qml/qmlplugindump/tst_qmlplugindump.pro b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.pro
new file mode 100644
index 0000000000..be0a0a49b6
--- /dev/null
+++ b/tests/auto/qml/qmlplugindump/tst_qmlplugindump.pro
@@ -0,0 +1,9 @@
+QT += testlib gui-private qml
+macx:CONFIG -= app_bundle
+
+CONFIG += testcase
+
+include(../../shared/util.pri)
+
+DEFINES += QT_QMLTEST_DIR=\\\"$${_PRO_FILE_PWD_}\\\"
+SOURCES += tst_qmlplugindump.cpp
diff --git a/tests/manual/qmlplugindump/README b/tests/manual/qmlplugindump/README
deleted file mode 100644
index 537afbba6e..0000000000
--- a/tests/manual/qmlplugindump/README
+++ /dev/null
@@ -1,42 +0,0 @@
-Tests for qmlplugindump
------------------------
-
-The test are executed by compiling a series of sample projects and
-running qmlplugindump on them, checking the generated plugin.qmltypes
-files. Each test, except `builtins`, need a sample project in order
-to be executed. A test is defined by:
-
- - test name
- - sample project name
- - sample project version
- - expected results
-
-That means that different tests can use the same sample project, but
-it is not possible to define a test that use more than one sample.
-Test definitions are stored in the folder `definitions` as json files;
-the file name is the test name, tests are executed in lexicographical
-order on their names, and the contents defines the other properties in
-the following format:
-
- {
- "project": <project-name>,
- "version": <version>,
- "expected": [<regexp-patterns>*],
- }
-
-where _project-name_, _version_, and _regexp-patterns_ are strings.
-
-The first two parameters are used to invoke qmlplugindump:
-
- qmlplugindump -nonrelocatable <uri> <version> <path>
-
-where:
-
- <uri> = tests.dumper.<project-name>
- <path> = <test-root>
-
-therefore, it is important that the sample projects resides in
-a subdirectory of `tests/dumper` named as the project itself.
-
-The last parameter is a list of regular expression patterns that
-must match the `plugin.qmltypes` produced by qmlplugindump.
diff --git a/tests/manual/qmlplugindump/definitions/000_dummy.json b/tests/manual/qmlplugindump/definitions/000_dummy.json
deleted file mode 100644
index 15f62bbc13..0000000000
--- a/tests/manual/qmlplugindump/definitions/000_dummy.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "project": "Dummy",
- "version": "1.0",
- "expected": ["name: \"Dummy\""]
-}
diff --git a/tests/manual/qmlplugindump/definitions/001_versions.json b/tests/manual/qmlplugindump/definitions/001_versions.json
deleted file mode 100644
index 185057f90d..0000000000
--- a/tests/manual/qmlplugindump/definitions/001_versions.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "project": "Versions",
- "version": "1.0",
- "expected": [
- "name: \"Versions\"",
- "tests\\.dumper\\.Versions/Versions 1\\.0"
- ]
-}
diff --git a/tests/manual/qmlplugindump/definitions/002_revisions.json b/tests/manual/qmlplugindump/definitions/002_revisions.json
deleted file mode 100644
index 7f3d86ffe8..0000000000
--- a/tests/manual/qmlplugindump/definitions/002_revisions.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "project": "Versions",
- "version": "1.1",
- "expected": [
- "name: \"Versions\"",
- "tests\\.dumper\\.Versions/Versions 1\\.1",
- "exportMetaObjectRevisions: \\[0, 1\\]"
- ]
-}
diff --git a/tests/manual/qmlplugindump/qmlplugindump.pro b/tests/manual/qmlplugindump/qmlplugindump.pro
deleted file mode 100644
index 51a5e82781..0000000000
--- a/tests/manual/qmlplugindump/qmlplugindump.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmlplugindump
-QT += testlib gui-private
-osx:CONFIG -= app_bundle
-CONFIG += parallel_test
-
-DEFINES += QT_TEST_DIR=\\\"$${_PRO_FILE_PWD_}/\\\"
-
-SOURCES += tst_qmlplugindump.cpp
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.cpp b/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.cpp
deleted file mode 100644
index 0ca82f20e2..0000000000
--- a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.cpp
+++ /dev/null
@@ -1,44 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "dummy.h"
-
-Dummy::Dummy(QQuickItem *parent):
- QQuickItem(parent)
-{
- // By default, QQuickItem does not draw anything. If you subclass
- // QQuickItem to create a visual item, you will need to uncomment the
- // following line and re-implement updatePaintNode()
-
- // setFlag(ItemHasContents, true);
-}
-
-Dummy::~Dummy()
-{
-}
-
diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro b/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro
deleted file mode 100644
index 81975ee01c..0000000000
--- a/tests/manual/qmlplugindump/tests/dumper/Dummy/dummy.pro
+++ /dev/null
@@ -1,33 +0,0 @@
-TEMPLATE = lib
-TARGET = Dummy
-QT += qml quick
-CONFIG += qt plugin
-
-TARGET = $$qtLibraryTarget($$TARGET)
-uri = tests.dumper.Dummy
-
-# Input
-SOURCES += \
- dummy_plugin.cpp \
- dummy.cpp
-
-HEADERS += \
- dummy_plugin.h \
- dummy.h
-
-DISTFILES = qmldir
-
-!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
- cpqmldir.files = qmldir
- cpqmldir.path = $$OUT_PWD
- COPIES += cpqmldir
-}
-
-qmldir.files = qmldir
-unix {
- installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
- qmldir.path = $$installPath
- target.path = $$installPath
- INSTALLS += target qmldir
-}
-
diff --git a/tests/manual/qmlplugindump/tests/dumper/Dummy/qmldir b/tests/manual/qmlplugindump/tests/dumper/Dummy/qmldir
deleted file mode 100644
index a1b2e789ba..0000000000
--- a/tests/manual/qmlplugindump/tests/dumper/Dummy/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module tests.dumper.Dummy
-plugin Dummy
-
diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.cpp b/tests/manual/qmlplugindump/tests/dumper/Imports/imports.cpp
deleted file mode 100644
index d2296ce6ba..0000000000
--- a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.cpp
+++ /dev/null
@@ -1,44 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "imports.h"
-
-Imports::Imports(QQuickItem *parent):
- QQuickItem(parent)
-{
- // By default, QQuickItem does not draw anything. If you subclass
- // QQuickItem to create a visual item, you will need to uncomment the
- // following line and re-implement updatePaintNode()
-
- // setFlag(ItemHasContents, true);
-}
-
-Imports::~Imports()
-{
-}
-
diff --git a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro b/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro
deleted file mode 100644
index 1033c7a28f..0000000000
--- a/tests/manual/qmlplugindump/tests/dumper/Imports/imports.pro
+++ /dev/null
@@ -1,33 +0,0 @@
-TEMPLATE = lib
-TARGET = Imports
-QT += qml quick
-CONFIG += qt plugin
-
-TARGET = $$qtLibraryTarget($$TARGET)
-uri = tests.dumper.Imports
-
-# Input
-SOURCES += \
- imports_plugin.cpp \
- imports.cpp
-
-HEADERS += \
- imports_plugin.h \
- imports.h
-
-DISTFILES = qmldir
-
-!equals(_PRO_FILE_PWD_, $$OUT_PWD) {
- cpqmldir.files = qmldir
- cpqmldir.path = $$OUT_PWD
- COPIES += cpqmldir
-}
-
-qmldir.files = qmldir
-unix {
- installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /)
- qmldir.path = $$installPath
- target.path = $$installPath
- INSTALLS += target qmldir
-}
-
diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/qmldir b/tests/manual/qmlplugindump/tests/dumper/Versions/qmldir
deleted file mode 100644
index 382225f517..0000000000
--- a/tests/manual/qmlplugindump/tests/dumper/Versions/qmldir
+++ /dev/null
@@ -1,3 +0,0 @@
-module tests.dumper.Versions
-plugin Versions
-
diff --git a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.cpp b/tests/manual/qmlplugindump/tests/dumper/Versions/versions.cpp
deleted file mode 100644
index e5f435ca7f..0000000000
--- a/tests/manual/qmlplugindump/tests/dumper/Versions/versions.cpp
+++ /dev/null
@@ -1,44 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "versions.h"
-
-Versions::Versions(QQuickItem *parent):
- QQuickItem(parent)
-{
- // By default, QQuickItem does not draw anything. If you subclass
- // QQuickItem to create a visual item, you will need to uncomment the
- // following line and re-implement updatePaintNode()
-
- // setFlag(ItemHasContents, true);
-}
-
-Versions::~Versions()
-{
-}
-
diff --git a/tests/manual/qmlplugindump/tst_qmlplugindump.cpp b/tests/manual/qmlplugindump/tst_qmlplugindump.cpp
deleted file mode 100644
index c5047a63a7..0000000000
--- a/tests/manual/qmlplugindump/tst_qmlplugindump.cpp
+++ /dev/null
@@ -1,371 +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:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qtest.h>
-#include <QLibraryInfo>
-#include <QDir>
-#include <QDirIterator>
-#include <QProcess>
-#include <QRegularExpression>
-#include <QJsonDocument>
-#include <QJsonParseError>
-#include <QJsonObject>
-#include <QJsonArray>
-#include <QJsonValue>
-
-#include <QDebug>
-
-#include <cstdlib>
-#include <algorithm>
-
-
-// System dependent definitions
-
-#if defined(Q_OS_WIN)
-
-static const char* systemMakeProgram = "jom";
-static const char* systemQmlplugindumpProgram = "qmlplugindump.exe";
-
-static const QString libname(const QString &name)
-{
- return name + QLatin1String(".dll");
-}
-
-#elif defined(Q_OS_DARWIN)
-
-static const char* systemMakeProgram = "make";
-static const char* systemQmlplugindumpProgram = "qmlplugindump";
-
-static const QString libname(const QString &name)
-{
- return QLatin1String("lib") + name + QLatin1String(".dynlib");
-}
-
-#else
-
-static const char* systemMakeProgram = "make";
-static const char* systemQmlplugindumpProgram = "qmlplugindump";
-
-static const QString libname(const QString &name)
-{
- return QLatin1String("lib") + name + QLatin1String(".so");
-}
-
-#endif
-
-
-// Utilities
-
-
-// Functor for matching a list of regular expression on a buffer.
-//
-class RegexpsChecker
-{
-public:
- RegexpsChecker(const QStringList &expected) : m_expected(expected) {}
- bool operator()(const QByteArray &buffer) const
- {
- QRegularExpression re;
- QRegularExpressionMatch m;
- for (const QString &e : m_expected) {
- re.setPattern(e);
- m = re.match(QString::fromLatin1(buffer));
- if (!m.hasMatch()) {
- qWarning() << "Pattern not found: " << e;
- return false;
- }
- }
- return true;
- }
-private:
- const QStringList m_expected;
-};
-
-
-// Run an external process in given path and with given arguments, if presents.
-// Optionally run a regexp check on the process standard output.
-//
-bool run(const QString &path, const QString &cmd, const QStringList &args=QStringList(),
- const RegexpsChecker *checker=0) {
- QProcess process;
- process.setWorkingDirectory(path);
- process.start(cmd, args);
- process.waitForFinished();
- if (process.error() == QProcess::FailedToStart) {
- qWarning() << cmd << args << "failed to start.";
- return false;
- }
- if (process.error() == QProcess::Crashed) {
- qWarning() << cmd << args << "crashed.";
- return false;
- }
- if (process.exitStatus() != QProcess::NormalExit) {
- qWarning() << cmd << args << "exited with code: " << process.exitCode();
- return false;
- }
- if (checker)
- (*checker)(process.readAllStandardOutput());
- return true;
-}
-
-
-// Test Definition
-//
-// A test is defined by id, project, version and expected patterns that should
-// match the output of qmlplugindump.
-//
-class Test
-{
-public:
- Test(const QString &testId) : id(testId) {}
- Test(const QString &testId, const QString &prjName, const QString &prjVersion,
- const QStringList &expectedResult) :
- id(testId), project(prjName), version(prjVersion), expected(expectedResult) {}
- QString id;
- QString project;
- QString version;
- QStringList expected;
- bool isNull() const
- {
- return project.isEmpty() || version.isEmpty();
- }
- friend bool operator<(const Test &t1, const Test &t2) { return t1.id < t2.id; }
-};
-
-
-// Create test from a json document.
-//
-// The json document must contains these fields:
-//
-// project: string
-// version: string
-// expected: [string*]
-//
-// qmlplugindumper will be invoked with these arguments:
-//
-// qmlplugindumper tests.dumper.<PROJECT> <VERSION>
-//
-// PROJECT is the name of the sample project. It is used as a project name
-// and as the last components of the URI: tests.dumper.<PROJECT>; the project
-// path must be ./test/dumper/<PROJECT>.
-//
-// EXPECTED is a list of regular expression patterns that must match the
-// plugin.qmltypes produced by qmlplugindump.
-//
-Test createTest(const QString &id, const QJsonObject &def)
-{
- QJsonValue project = def.value(QLatin1String("project"));
- QJsonValue version = def.value(QLatin1String("version"));
- QJsonValue expected = def.value(QLatin1String("expected"));
- if (!project.isString() || !version.isString() || !expected.isArray()){
- qWarning() << "Wrong definition for test: " << id << ".";
- return Test(id);
- }
- QStringList patterns;
- const auto expectedArray = expected.toArray();
- for (const QJsonValue &x : expectedArray) {
- if (!x.isString()) {
- qWarning() << "Wrong definition for test: " << id << ".";
- return Test(id);
- } else {
- patterns << x.toString();
- }
- }
- return Test(id, project.toString(), version.toString(), patterns);
-}
-
-// Read a test definition from a file.
-//
-// The file must define a json document that `createTest' can understand.
-//
-Test readTestDefinition(const QFileInfo &file)
-{
- const QString path = file.filePath();
- const QString id = file.baseName();
- QFile fd(path);
- if (fd.open(QIODevice::ReadOnly)) {
- QTextStream in(&fd);
- QJsonParseError err;
- QJsonDocument doc = QJsonDocument::fromJson(in.readAll().toLatin1(), &err);
- fd.close();
- if (err.error != QJsonParseError::NoError) {
- qWarning() << "Parse error in test \"" << id << "\":" << err.errorString();
- return Test(id);
- }
- QJsonObject obj = doc.object();
- return createTest(id, obj);
- }
- qWarning() << "Cannot open " << path << ".";
- return Test(id);
-}
-
-// Read all files in `path' as test definitions.
-//
-// Returns a list of tests sorted lexicographically.
-//
-QList<Test> readAllTestDefinitions(const QString &path)
-{
- QList<Test> samples;
- QDirIterator it(path, QDir::Files);
- while (it.hasNext()) {
- it.next();
- samples << readTestDefinition(it.fileInfo());
- }
- std::sort(samples.begin(), samples.end());
- return samples;
-}
-
-
-// TEST SUITE
-
-class tst_qmlplugindump : public QObject
-{
- Q_OBJECT
-public:
- tst_qmlplugindump();
-
-private slots:
- void initTestCase();
- void builtins();
- void plugin_data();
- void plugin();
- void cleanupTestCase();
-
-private:
- static const char *prefix;
- QString dumper;
- QList<Test> tests;
- QString samplePath(const QString &name);
- bool compileSample(const QString &name);
- bool cleanUpSample(const QString &name);
-};
-
-const char *tst_qmlplugindump::prefix = "tests.dumper.";
-
-tst_qmlplugindump::tst_qmlplugindump()
-{
-}
-
-QString tst_qmlplugindump::samplePath(const QString &name)
-{
- return QT_TEST_DIR
- + QLatin1Char('/')
- + QString(QLatin1String(prefix)).replace(QRegularExpression(QLatin1String("\\.")),
- QLatin1String("/")).append(name);
-}
-
-bool tst_qmlplugindump::compileSample(const QString &name)
-{
- const QString path = samplePath(name);
- return run(path, QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmake"))
- && run(path, QLatin1String(systemMakeProgram));
-}
-
-bool tst_qmlplugindump::cleanUpSample(const QString &name)
-{
- const QString path = samplePath(name);
- const QStringList args(QLatin1String("clean"));
- if (!run(path, QLatin1String(systemMakeProgram), args))
- return false;
-
- const QString libfile = path + QLatin1Char('/') + libname(name);
-
- if (!QFile::remove(libfile)) {
- qWarning() << "Cannot remove" << libfile << ".";
- return false;
- }
- return true;
-}
-
-void tst_qmlplugindump::initTestCase()
-{
- dumper = QLibraryInfo::location(QLibraryInfo::BinariesPath);
- tests = readAllTestDefinitions(QT_TEST_DIR "/definitions");
-
- dumper += QLatin1Char('/') + QLatin1String(systemQmlplugindumpProgram);
-
- if (!QFileInfo(dumper).exists()) {
- QString message = QString::fromLatin1("qmlplugindump executable not found (looked for %0)")
- .arg(dumper);
- QFAIL(qPrintable(message));
- }
-}
-
-void tst_qmlplugindump::builtins()
-{
- QStringList args;
- args += QLatin1String("-builtins");
- RegexpsChecker check(QStringList(QLatin1String("Module {")));
- QString cwd = QT_TEST_DIR;
- QVERIFY(run(cwd, dumper, args, &check));
-}
-
-void tst_qmlplugindump::plugin_data()
-{
- QTest::addColumn<QString>("project");
- QTest::addColumn<QString>("version");
- QTest::addColumn<QStringList>("expected");
-
- for (const Test &t : qAsConst(tests)) {
- if (t.isNull())
- QSKIP("Errors in test definition.");
- QTest::newRow(t.id.toLatin1().data()) << t.project << t.version << t.expected;
- }
-}
-
-void tst_qmlplugindump::plugin()
-{
- QFETCH(QString, project);
- QFETCH(QString, version);
- QFETCH(QStringList, expected);
-
- QVERIFY(compileSample(project));
-
- QStringList args;
- QString url = QLatin1String("tests.dumper.") + project;
- QString cwd = QT_TEST_DIR;
- args << QLatin1String("-nonrelocatable") << url << version << cwd;
- RegexpsChecker check(expected);
- QVERIFY(run(cwd, dumper, args, &check));
-}
-
-void tst_qmlplugindump::cleanupTestCase()
-{
- QSet<const QString> projects;
- for (const Test &t : qAsConst(tests))
- projects.insert(t.project);
- for (const QString &p : qAsConst(projects)) {
- if (!cleanUpSample(p))
- qWarning() << "Error in cleaning up project" << p << ".";
- }
-}
-
-
-QTEST_MAIN(tst_qmlplugindump)
-
-#include "tst_qmlplugindump.moc"
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index dffac93f20..8f9ac2d1da 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -146,7 +146,7 @@ void collectReachableMetaObjects(QObject *object, QSet<const QMetaObject *> *met
void collectReachableMetaObjects(QQmlEnginePrivate *engine, const QQmlType &ty, QSet<const QMetaObject *> *metas)
{
- collectReachableMetaObjects(ty.metaObject(), metas, ty.isExtendedType());
+ collectReachableMetaObjects(ty.baseMetaObject(), metas, ty.isExtendedType());
if (ty.attachedPropertiesType(engine))
collectReachableMetaObjects(ty.attachedPropertiesType(engine), metas);
}
@@ -214,7 +214,7 @@ QByteArray convertToId(const QMetaObject *mo)
void collectReachableMetaObjectsWithoutQmlName(QQmlEnginePrivate *engine, QSet<const QMetaObject *>& metas ) {
const auto qmlAllTypes = QQmlMetaType::qmlAllTypes();
for (const QQmlType &ty : qmlAllTypes) {
- if ( ! metas.contains(ty.metaObject()) ) {
+ if (!metas.contains(ty.baseMetaObject())) {
if (!ty.isComposite()) {
collectReachableMetaObjects(engine, ty, &metas);
} else {
@@ -232,55 +232,20 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
QSet<const QMetaObject *> metas;
metas.insert(FriendlyQObject::qtMeta());
- QHash<QByteArray, QSet<QByteArray> > extensions;
const auto qmlTypes = QQmlMetaType::qmlTypes();
for (const QQmlType &ty : qmlTypes) {
if (!ty.isCreatable())
- noncreatables.insert(ty.metaObject());
+ noncreatables.insert(ty.baseMetaObject());
if (ty.isSingleton())
- singletons.insert(ty.metaObject());
+ singletons.insert(ty.baseMetaObject());
if (!ty.isComposite()) {
- qmlTypesByCppName[ty.metaObject()->className()].insert(ty);
- if (ty.isExtendedType())
- extensions[ty.typeName()].insert(ty.metaObject()->className());
+ qmlTypesByCppName[ty.baseMetaObject()->className()].insert(ty);
collectReachableMetaObjects(QQmlEnginePrivate::get(engine), ty, &metas);
} else {
qmlTypesByCompositeName[ty.elementName()].insert(ty);
}
}
- // Adjust exports of the base object if there are extensions.
- // For each export of a base object there can be a single extension object overriding it.
- // Example: QDeclarativeGraphicsWidget overrides the QtQuick/QGraphicsWidget export
- // of QGraphicsWidget.
- for (auto it = extensions.cbegin(), end = extensions.cend(); it != end; ++it) {
- QSet<QQmlType> baseExports = qmlTypesByCppName.value(it.key());
-
- const QSet<QByteArray> extensionCppNames = it.value();
- for (const QByteArray &extensionCppName : extensionCppNames) {
- const QSet<QQmlType> extensionExports = qmlTypesByCppName.value(extensionCppName);
-
- // remove extension exports from base imports
- // unfortunately the QQmlType pointers don't match, so can't use QSet::subtract
- QSet<QQmlType> newBaseExports;
- for (const QQmlType &baseExport : qAsConst(baseExports)) {
- bool match = false;
- for (const QQmlType &extensionExport : extensionExports) {
- if (baseExport.qmlTypeName() == extensionExport.qmlTypeName()
- && baseExport.majorVersion() == extensionExport.majorVersion()
- && baseExport.minorVersion() == extensionExport.minorVersion()) {
- match = true;
- break;
- }
- }
- if (!match)
- newBaseExports.insert(baseExport);
- }
- baseExports = newBaseExports;
- }
- qmlTypesByCppName[it.key()] = baseExports;
- }
-
if (creatable) {
// find even more QMetaObjects by instantiating QML types and running
// over the instances
@@ -405,15 +370,7 @@ public:
void writeMetaContent(const QMetaObject *meta, KnownAttributes *knownAttributes = nullptr)
{
- QSet<QString> implicitSignals;
- for (int index = meta->propertyOffset(); index < meta->propertyCount(); ++index) {
- const QMetaProperty &property = meta->property(index);
- dump(property, knownAttributes);
- if (knownAttributes)
- knownAttributes->knownMethod(QByteArray(property.name()).append("Changed"),
- 0, property.revision());
- implicitSignals.insert(QString("%1Changed").arg(QString::fromUtf8(property.name())));
- }
+ QSet<QString> implicitSignals = dumpMetaProperties(meta, 0, knownAttributes);
if (meta == &QObject::staticMetaObject) {
// for QObject, hide deleteLater() and onDestroyed
@@ -533,6 +490,27 @@ public:
qml->writeEndObject();
}
+ QString getDefaultProperty(const QMetaObject *meta)
+ {
+ for (int index = meta->classInfoCount() - 1; index >= 0; --index) {
+ QMetaClassInfo classInfo = meta->classInfo(index);
+ if (QLatin1String(classInfo.name()) == QLatin1String("DefaultProperty")) {
+ return QLatin1String(classInfo.value());
+ }
+ }
+ return QString();
+ }
+
+ struct QmlTypeInfo {
+ QmlTypeInfo() {}
+ QmlTypeInfo(const QString &exportString, int revision, const QMetaObject *extendedObject, QByteArray attachedTypeId)
+ : exportString(exportString), revision(revision), extendedObject(extendedObject), attachedTypeId(attachedTypeId) {}
+ QString exportString;
+ int revision = 0;
+ const QMetaObject *extendedObject = nullptr;
+ QByteArray attachedTypeId;
+ };
+
void dump(QQmlEnginePrivate *engine, const QMetaObject *meta, bool isUncreatable, bool isSingleton)
{
qml->writeStartObject("Component");
@@ -540,29 +518,58 @@ public:
QByteArray id = convertToId(meta);
qml->writeScriptBinding(QLatin1String("name"), enquote(id));
- for (int index = meta->classInfoCount() - 1 ; index >= 0 ; --index) {
- QMetaClassInfo classInfo = meta->classInfo(index);
- if (QLatin1String(classInfo.name()) == QLatin1String("DefaultProperty")) {
- qml->writeScriptBinding(QLatin1String("defaultProperty"), enquote(QLatin1String(classInfo.value())));
- break;
+ // collect type information
+ QVector<QmlTypeInfo> typeInfo;
+ for (QQmlType type : qmlTypesByCppName.value(meta->className())) {
+ const QMetaObject *extendedObject = type.extensionFunction() ? type.metaObject() : nullptr;
+ QByteArray attachedTypeId;
+ if (const QMetaObject *attachedType = type.attachedPropertiesType(engine)) {
+ // Can happen when a type is registered that returns itself as attachedPropertiesType()
+ // because there is no creatable type to attach to.
+ if (attachedType != meta)
+ attachedTypeId = convertToId(attachedType);
+ }
+ const QString exportString = getExportString(type.qmlTypeName(), type.majorVersion(), type.minorVersion());
+ int metaObjectRevision = type.metaObjectRevision();
+ if (extendedObject) {
+ // emulate custom metaobjectrevision out of import
+ metaObjectRevision = type.majorVersion() * 100 + type.minorVersion();
+ }
+
+ QmlTypeInfo info = { exportString, metaObjectRevision, extendedObject, attachedTypeId };
+ typeInfo.append(info);
+ }
+
+ // sort to ensure stable output
+ std::sort(typeInfo.begin(), typeInfo.end(), [](const QmlTypeInfo &i1, const QmlTypeInfo &i2) {
+ return i1.revision < i2.revision;
+ });
+
+ // determine default property
+ // TODO: support revisioning of default property
+ QString defaultProperty = getDefaultProperty(meta);
+ if (defaultProperty.isEmpty()) {
+ for (const QmlTypeInfo &iter : typeInfo) {
+ if (iter.extendedObject) {
+ defaultProperty = getDefaultProperty(iter.extendedObject);
+ if (!defaultProperty.isEmpty())
+ break;
+ }
}
}
+ if (!defaultProperty.isEmpty())
+ qml->writeScriptBinding(QLatin1String("defaultProperty"), enquote(defaultProperty));
if (meta->superClass())
qml->writeScriptBinding(QLatin1String("prototype"), enquote(convertToId(meta->superClass())));
- const QSet<QQmlType> qmlTypes = qmlTypesByCppName.value(meta->className());
- if (!qmlTypes.isEmpty()) {
- QHash<QString, QQmlType> exports;
-
- for (const QQmlType &qmlTy : qmlTypes) {
- const QString exportString = getExportString(qmlTy.qmlTypeName(), qmlTy.majorVersion(), qmlTy.minorVersion());
- exports.insert(exportString, qmlTy);
- }
+ if (!typeInfo.isEmpty()) {
+ QMap<QString, QString> exports; // sort exports
+ for (const QmlTypeInfo &iter : typeInfo)
+ exports.insert(iter.exportString, QString::number(iter.revision));
- // ensure exports are sorted and don't change order when the plugin is dumped again
QStringList exportStrings = exports.keys();
- std::sort(exportStrings.begin(), exportStrings.end());
+ QStringList metaObjectRevisions = exports.values();
qml->writeArrayBinding(QLatin1String("exports"), exportStrings);
if (isUncreatable)
@@ -571,20 +578,12 @@ public:
if (isSingleton)
qml->writeBooleanBinding(QLatin1String("isSingleton"), true);
- // write meta object revisions
- QStringList metaObjectRevisions;
- for (const QString &exportString : qAsConst(exportStrings)) {
- int metaObjectRevision = exports[exportString].metaObjectRevision();
- metaObjectRevisions += QString::number(metaObjectRevision);
- }
qml->writeArrayBinding(QLatin1String("exportMetaObjectRevisions"), metaObjectRevisions);
- if (const QMetaObject *attachedType = (*qmlTypes.begin()).attachedPropertiesType(engine)) {
- // Can happen when a type is registered that returns itself as attachedPropertiesType()
- // because there is no creatable type to attach to.
- if (attachedType != meta) {
- qml->writeScriptBinding(QLatin1String("attachedType"), enquote(
- convertToId(attachedType)));
+ for (const QmlTypeInfo &iter : typeInfo) {
+ if (!iter.attachedTypeId.isEmpty()) {
+ qml->writeScriptBinding(QLatin1String("attachedType"), enquote(iter.attachedTypeId));
+ break;
}
}
}
@@ -594,6 +593,12 @@ public:
writeMetaContent(meta);
+ // dump properties from extended metaobjects last
+ for (auto iter : typeInfo) {
+ if (iter.extendedObject)
+ dumpMetaProperties(iter.extendedObject, iter.revision);
+ }
+
qml->writeEndObject();
}
@@ -642,9 +647,9 @@ private:
qml->writeScriptBinding(QLatin1String("isPointer"), QLatin1String("true"));
}
- void dump(const QMetaProperty &prop, KnownAttributes *knownAttributes = nullptr)
+ void dump(const QMetaProperty &prop, int metaRevision = -1, KnownAttributes *knownAttributes = nullptr)
{
- int revision = prop.revision();
+ int revision = metaRevision ? metaRevision : prop.revision();
QByteArray propName = prop.name();
if (knownAttributes && knownAttributes->knownProperty(propName, revision))
return;
@@ -657,6 +662,20 @@ private:
qml->writeEndObject();
}
+ QSet<QString> dumpMetaProperties(const QMetaObject *meta, int metaRevision = -1, KnownAttributes *knownAttributes = nullptr)
+ {
+ QSet<QString> implicitSignals;
+ for (int index = meta->propertyOffset(); index < meta->propertyCount(); ++index) {
+ const QMetaProperty &property = meta->property(index);
+ dump(property, metaRevision, knownAttributes);
+ if (knownAttributes)
+ knownAttributes->knownMethod(QByteArray(property.name()).append("Changed"),
+ 0, property.revision());
+ implicitSignals.insert(QString("%1Changed").arg(QString::fromUtf8(property.name())));
+ }
+ return implicitSignals;
+ }
+
void dump(const QMetaMethod &meth, const QSet<QString> &implicitSignals,
KnownAttributes *knownAttributes = nullptr)
{
@@ -836,9 +855,11 @@ static bool getDependencies(const QQmlEngine &engine, const QString &pluginImpor
const QString &pluginImportVersion, QStringList *dependencies,
bool forceQtQuickDependency)
{
+ QString importScannerExe = QLatin1String("qmlimportscanner");
QFileInfo selfExe(QCoreApplication::applicationFilePath());
- QString command = selfExe.absoluteDir().filePath(QLatin1String("qmlimportscanner")
- + selfExe.suffix());
+ if (!selfExe.suffix().isEmpty())
+ importScannerExe += QLatin1String(".") + selfExe.suffix();
+ QString command = selfExe.absoluteDir().filePath(importScannerExe);
QStringList commandArgs = QStringList()
<< QLatin1String("-qmlFiles")