diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-01-15 12:57:01 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-17 08:10:07 +0100 |
commit | 6547d53e6555f90065c045b718084557001f0245 (patch) | |
tree | cde83beeec3cf5630377645ec75066020230cf8a /src/qml | |
parent | bf13e5045739f9766ed3c8ac1be1c672ce655dae (diff) |
[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 <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/compiler/qqmltypecompiler.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
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; |