aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-05-06 09:57:07 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-05-12 17:39:23 +0200
commit3359cfcae098401b4d18e5ca4f4f09763c9cea1c (patch)
tree7fdca71601c8ca25bcbb37a21499bcf0329efde8 /tests/auto/qml
parent7e0f3d17ce74be1e48c25a8601d863adb8066700 (diff)
Generalize role selection mechanism from QQuickComboBox
We can have QQmlDelegateModel pick specific roles from model items. That can easily be done for variant maps, variant hashes, objects and gadgets. We would like to do it for anything that has a QMetaAssociation, but as we cannot get to the original type at that place, it's currently not possible. The special case about variant maps with exactly one item in variant lists is clearly insane and therefore not included in the generalization. This requires some cleanup in the QQmlGadgetPointerWrapper. Passing the wrapper itself to QMetaProperty::read() has always been a rather obscure way of reading from the gadget. Fixes: QTBUG-102983 Change-Id: I84ecef980783e7137aa4d77070ddce47b6ead260 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit d0c7c7234cb7629fbe7a04944cb5191414cc72b9)
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 402a68afae..5d426cff4f 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -1943,8 +1943,8 @@ void tst_qqmlproperty::variantMapHandling()
void tst_qqmlproperty::crashOnValueProperty()
{
- QQmlEngine *engine = new QQmlEngine;
- QQmlComponent component(engine);
+ QScopedPointer<QQmlEngine> engine(new QQmlEngine);
+ QQmlComponent component(engine.data());
component.setData("import Test 1.0\nPropertyObject { wrectProperty.x: 10 }", QUrl());
QScopedPointer<QObject> object(component.create());
@@ -1957,8 +1957,7 @@ void tst_qqmlproperty::crashOnValueProperty()
QCOMPARE(p.read(), QVariant(10));
//don't crash once the engine is deleted
- delete engine;
- engine = nullptr;
+ engine.reset();
QCOMPARE(p.propertyTypeName(), "int");
QCOMPARE(p.read(), QVariant(10));