From 28eb0caec23e0c315056cb035535b8806ccb0f37 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 5 Sep 2019 16:41:11 +0200 Subject: Force creation of metaobjects for top level objects and components We want those to be different types, even if they don't add any properties, signals etc. Otherwise you can cross-assign objects of components defined in different files. Fully-dynamic types, such as QQmlPropertyMap are still an exception to this. We need to use the original meta object so that you can still dynamically add properties to any derived types. Therefore, all types derived from QQmlPropertyMap are in fact just aliases of each other. Also, types which aren't addressable from the outside don't get their own meta object. Types are addressable if they live in files and the file name starts with an uppercase character. Otherwise there is no way to refer to the component from anywhere else in QML. Fixes: QTBUG-76021 Change-Id: I96a01fdad13e50e4705520fec46f2b3373e0c365 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp') diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 79ec507388..1d2fa42b75 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -222,12 +222,12 @@ void tst_qqmlcomponent::qmlCreateObjectAutoParent() QVERIFY(window_item); QVERIFY(window_window); - QCOMPARE(qtobject_item->metaObject()->className(), "QQuickItem"); - QCOMPARE(qtobject_window->metaObject()->className(), "QQuickWindow"); - QCOMPARE(item_item->metaObject()->className(), "QQuickItem"); - QCOMPARE(item_window->metaObject()->className(), "QQuickWindow"); - QCOMPARE(window_item->metaObject()->className(), "QQuickItem"); - QCOMPARE(window_window->metaObject()->className(), "QQuickWindow"); + QVERIFY(QByteArray(qtobject_item->metaObject()->className()).startsWith("QQuickItem")); + QVERIFY(QByteArray(qtobject_window->metaObject()->className()).startsWith("QQuickWindow")); + QVERIFY(QByteArray(item_item->metaObject()->className()).startsWith("QQuickItem")); + QVERIFY(QByteArray(item_window->metaObject()->className()).startsWith("QQuickWindow")); + QVERIFY(QByteArray(window_item->metaObject()->className()).startsWith("QQuickItem")); + QVERIFY(QByteArray(window_window->metaObject()->className()).startsWith("QQuickWindow")); QCOMPARE(qtobject_qtobject->parent(), qtobjectParent); QCOMPARE(qtobject_item->parent(), qtobjectParent); -- cgit v1.2.3