Fix lookup of non scriptable default properties.
authorRoberto Raggi <roberto.raggi@nokia.com>
Mon, 22 Aug 2011 11:46:33 +0000 (13:46 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 30 Aug 2011 11:18:28 +0000 (13:18 +0200)
Change-Id: I027169a54dc0041212d38aefc99164930c31d2b2
Reviewed-on: http://codereview.qt.nokia.com/3793
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
src/declarative/qml/qdeclarativecompiler.cpp

index 7ae571c..bd99a33 100644 (file)
@@ -1578,13 +1578,6 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
         prop->value->metatype = type->attachedPropertiesType();
     } else {
         // Setup regular property data
-        if (prop->isDefault) {
-            QMetaProperty p = QDeclarativeMetaType::defaultProperty(metaObject);
-
-            if (p.name())
-                prop->setName(p.name());
-        }
-
         bool notInRevision = false;
         QDeclarativePropertyCache::Data *d = 
             prop->name().isEmpty()?0:property(obj, prop->name(), &notInRevision);
@@ -1600,6 +1593,14 @@ bool QDeclarativeCompiler::buildProperty(QDeclarativeParser::Property *prop,
         } else if (d) {
             prop->index = d->coreIndex;
             prop->core = *d;
+        } else if (prop->isDefault) {
+            QMetaProperty p = QDeclarativeMetaType::defaultProperty(metaObject);
+            QDeclarativePropertyCache::Data defaultPropertyData;
+            defaultPropertyData.load(p, engine);
+            if (p.name())
+                prop->setName(p.name());
+            prop->core = defaultPropertyData;
+            prop->index = prop->core.coreIndex;
         }
 
         // We can't error here as the "id" property does not require a