diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-10-04 10:37:42 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-10-07 07:51:42 +0200 |
commit | a3ccbde329ade1d0102caee1fc84d81a81a55440 (patch) | |
tree | 9e07537680b91b8f001b9ce0504cd45e4cd147e8 /tests/auto/qml/qqmlmoduleplugin | |
parent | ea0ef32915cd36aee3d6b2eeaa76b14035432c21 (diff) |
tst_qqmlmoduleplugin: avoid setContextProperty
Change-Id: I5bebe3b50afc1dba39b73bd54679ef91b2a9ba8d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlmoduleplugin')
-rw-r--r-- | tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml | 7 | ||||
-rw-r--r-- | tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml b/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml index 9789be8191..258667be18 100644 --- a/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml +++ b/tests/auto/qml/qqmlmoduleplugin/moduleWithQmlSingleton/MySingleton.qml @@ -1,5 +1,6 @@ pragma Singleton import QtQuick 2.0 +import Test 1.0 QtObject { property Loader _loader: Loader { @@ -7,10 +8,10 @@ QtObject { } Component.onCompleted: { - if (tracker.objectName === "first") - tracker.objectName = "second" + if (Tracker.objectName === "first") + Tracker.objectName = "second" else - tracker.objectName = "first" + Tracker.objectName = "first" //console.log("created singleton", this) } } diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index f89cc9f24a..d2d6dc5d49 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -777,7 +777,7 @@ void tst_qqmlmoduleplugin::multiSingleton() { QQmlEngine engine; QObject obj; - engine.rootContext()->setContextProperty("tracker", &obj); + qmlRegisterSingletonInstance("Test", 1, 0, "Tracker", &obj); engine.addImportPath(m_importsDirectory); QQmlComponent component(&engine, testFileUrl("multiSingleton.qml")); QObject *object = component.create(); |