From 01ed625542f9b4233b8c1a940f78eff7292fc350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Fri, 28 Sep 2018 12:17:59 +0200 Subject: Teach QML that it is possible to treat custom QObjects as QObject It is always better to treat a QObject child as QObject then a QVariant. Change-Id: I4ac069e85232dd4d1411e325bc5b858bd001f9a6 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp') diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index 5cff44c3cc..6ccfc77c25 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -1720,6 +1720,14 @@ void tst_qqmlvaluetypes::sequences() for (int i = 0; i < objSet.size(); ++i) QCOMPARE(value.property(i).property("point").property("x").toInt(), a.point().x()); } + { + MyTypeObject a, b, c; + QSet container{&a, &b, &c}; + QJSValue value = engine.toScriptValue(container); + QCOMPARE(value.property("length").toInt(), container.size()); + for (int i = 0; i < container.size(); ++i) + QCOMPARE(value.property(i).property("point").property("x").toInt(), a.point().x()); + } } struct StringLessGadget { Q_GADGET -- cgit v1.2.3