From 6547d53e6555f90065c045b718084557001f0245 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 15 Jan 2014 12:57:01 +0100 Subject: [new compiler] Fix implicit component definition for default properties When trying to determine if an object binding should be a component or not and we don't have a property name for the binding, then we must check if the default property happens to be a QQmlComponent. Change-Id: Ie21fc438b8b2d86caa3991794e6eac688c074440 Reviewed-by: Lars Knoll --- src/qml/compiler/qqmltypecompiler.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index dd4f15d0e6..06f0be5944 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -772,6 +772,9 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQm PropertyResolver propertyResolver(propertyCache); + bool defaultPropertyQueried = false; + QQmlPropertyData *defaultProperty = 0; + for (QtQml::Binding *binding = obj->bindings->first; binding; binding = binding->next) { if (binding->type != QV4::CompiledData::Binding::Type_Object) continue; @@ -783,9 +786,18 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQm if (targetType && targetType->metaObject() == &QQmlComponent::staticMetaObject) continue; + QQmlPropertyData *pd = 0; QString propertyName = stringAt(binding->propertyNameIndex); - bool notInRevision = false; - QQmlPropertyData *pd = propertyResolver.property(propertyName, ¬InRevision); + if (!propertyName.isEmpty()) { + bool notInRevision = false; + pd = propertyResolver.property(propertyName, ¬InRevision); + } else { + if (!defaultPropertyQueried) { + defaultProperty = propertyCache->defaultProperty(); + defaultPropertyQueried = true; + } + pd = defaultProperty; + } if (!pd || !pd->isQObject()) continue; -- cgit v1.2.3