diff options
author | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2018-09-28 12:17:59 +0200 |
---|---|---|
committer | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2018-10-08 10:02:04 +0000 |
commit | 01ed625542f9b4233b8c1a940f78eff7292fc350 (patch) | |
tree | c87838d908b8faad2ec2174f157c03fbfb9fe4de /tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp | |
parent | 5f4b3fa3cade416b088fdc35f583c536269688d7 (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp')
-rw-r--r-- | tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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<MyTypeObject*> 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 |