aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-01-15 12:57:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-17 08:10:07 +0100
commit6547d53e6555f90065c045b718084557001f0245 (patch)
treecde83beeec3cf5630377645ec75066020230cf8a /src/qml
parentbf13e5045739f9766ed3c8ac1be1c672ce655dae (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.cpp16
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, &notInRevision);
+ if (!propertyName.isEmpty()) {
+ bool notInRevision = false;
+ pd = propertyResolver.property(propertyName, &notInRevision);
+ } else {
+ if (!defaultPropertyQueried) {
+ defaultProperty = propertyCache->defaultProperty();
+ defaultPropertyQueried = true;
+ }
+ pd = defaultProperty;
+ }
if (!pd || !pd->isQObject())
continue;