aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-12-09 08:06:18 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2021-12-10 06:52:35 +0100
commit8326ff2ac1472415b82734946435d3e7e75d522b (patch)
treeccafa1912fb16d092ca1645975ca11324cba550d /tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
parentcd5d62e9997c71e2105d571f681777c5a59c3ef1 (diff)
Instantiator: don't interfere with delegates that assign parents
[ChangeLog][QtQml][Instantiator] Instantiator now avoids re-assigning a delegate object's parent to itself if it was already set; thus, you can now declare a parent assignment. Task-number: QTBUG-64546 Task-number: QTBUG-84730 Change-Id: I7d95fa76e71c363b4cb5b7a512c2e984488c8af4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp')
-rw-r--r--tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
index 4c6c84a9d2..a0ab2cda5b 100644
--- a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
+++ b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp
@@ -56,6 +56,8 @@ private slots:
void asynchronous_data();
void asynchronous();
+
+ void handlerWithParent();
};
tst_qqmlinstantiator::tst_qqmlinstantiator()
@@ -276,6 +278,19 @@ void tst_qqmlinstantiator::asynchronous()
}
}
+void tst_qqmlinstantiator::handlerWithParent()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("handlerWithParent.qml"));
+ QObject *rootObject = component.create();
+ QVERIFY(rootObject != nullptr);
+ const auto handlers = rootObject->findChildren<QObject *>("pointHandler");
+ QCOMPARE(handlers.count(), 2);
+ for (const auto *h : handlers) {
+ QCOMPARE(h->parent(), rootObject);
+ }
+}
+
QTEST_MAIN(tst_qqmlinstantiator)
#include "tst_qqmlinstantiator.moc"