From 790268130926f318c007b41439c9d60463666e34 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 31 Mar 2014 09:58:13 +0200 Subject: Fix performance regression of parent setting during QML object creation This showed up in the profiles again: In QML we create a lot of objects with many children and sending a child event each time is expensive. That's why the VME didn't do that and hadn't done so in ages. This patch restores that behavior and aspect of loading performance. Change-Id: I5078fe330d913dc832b284aaecf031152dc80802 Reviewed-by: Lars Knoll --- tests/auto/qml/qqmllanguage/testtypes.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/auto/qml/qqmllanguage/testtypes.cpp') diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 8dd788869b..226206edfd 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -205,3 +205,20 @@ void SimpleObjectCustomParser::setCustomData(QObject *object, const QByteArray & o->setCustomBindingsCount(data.toInt(&ok)); Q_ASSERT(ok); } + + +MyQmlObject::MyQmlObject() + : m_value(-1) + , m_interface(0) + , m_qmlobject(0) + , m_childAddedEventCount(0) +{ + qRegisterMetaType("MyCustomVariantType"); +} + +bool MyQmlObject::event(QEvent *event) +{ + if (event->type() == QEvent::ChildAdded) + m_childAddedEventCount++; + return QObject::event(event); +} -- cgit v1.2.3