aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-08-23 14:52:35 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-10-02 08:46:46 +0000
commita5a814d26a8d02c0752fab9ec6cc8c2447c10182 (patch)
tree5cb848eb20b7c9c81512be17b48185b99e611c00 /tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
parentc612dc3d141d988642250ae5aa9a671fbae564c7 (diff)
QmlCompiler: Fix handling of anonymous composite types
So far we produced invalid QMetaTypes for them in various places and that "worked" for the most part because with QObject pointers we can introspect the actual type at run time. Realize that we never actually want the concrete anoymous type of the object when we pass it around. Rather, all methods and properties need to handle named types. What we really want to resolve is therefore not the type of the original value we've produced in the type propagator, but rather the replacement we've produced when analyzing the lookup. Pick-to: 6.8 Task-number: QTBUG-129202 Change-Id: I0b93495d6603f120375048c80a747170f147f8af Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io> (cherry picked from commit 14ff6822a061f9a11219e581c9c4ea80d1cd4c14) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp')
-rw-r--r--tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
index 824ad72601..dff891a330 100644
--- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
+++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp
@@ -41,6 +41,7 @@ private slots:
void ambiguousAs();
void ambiguousSignals();
void anchorsFill();
+ void anonymousComposite();
void argumentConversion();
void array();
void arrayCtor();
@@ -609,6 +610,16 @@ void tst_QmlCppCodegen::anchorsFill()
QCOMPARE(child->property("width").toInt(), 47);
}
+void tst_QmlCppCodegen::anonymousComposite()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, QUrl(u"qrc:/qt/qml/TestTypes/anonymousCompositeUser.qml"_s));
+ QVERIFY2(c.isReady(), qPrintable(c.errorString()));
+ QScopedPointer<QObject> o(c.create());
+ QVERIFY(!o.isNull());
+ QCOMPARE(o->property("b").toInt(), 5);
+}
+
void tst_QmlCppCodegen::argumentConversion()
{
QQmlEngine engine;