aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-03-26 16:39:00 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-29 00:36:49 +0200
commite4baefacff3e04ea3b599c5279e883d75d2ad489 (patch)
treedc78ce14db08c0aa771ddff9df8c23da8b8919ba /tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
parent5de103291d8159a236cabcc689caade265de1bd5 (diff)
Re-order imports statements to import nested imports later
Re-order the imports for a script by increasing order of URI length. This ensures that an import of the type 'import X.Y' is processed after the import of 'import X' which contains the type definitions for the namespace X.Y. Task-number: QTBUG-24369 Change-Id: I1b06e9d114a97c9f47279f8f33383a27e0efb4bb Reviewed-by: Chris Adams <christopher.adams@nokia.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp')
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
new file mode 100644
index 0000000000..2d0af471c2
--- /dev/null
+++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQml/qqml.h>
+#include <QDebug>
+
+class MyPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString value READ value)
+
+public:
+ MyPluginType(QObject *parent=0) : QObject(parent) {}
+
+ QString value() const { return "Hello"; }
+};
+
+class MyNestedPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString value READ value)
+
+public:
+ MyNestedPluginType(QObject *parent=0) : QObject(parent) {}
+
+ QString value() const { return "Goodbye"; }
+};
+
+
+class MyPlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "../empty.json")
+
+public:
+ MyPlugin() {}
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlNestedPluginType");
+ qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType");
+
+ QString nestedUri(uri);
+ nestedUri += QLatin1String(".Nested");
+
+ qmlRegisterType<MyNestedPluginType>(nestedUri.toLatin1().constData(), 1, 0, "MyNestedPluginType");
+ }
+};
+
+#include "nestedPlugin.moc"