groupObject = valueType;
valueTypeProperty = property;
} else {
- groupObjectPropertyCache = enginePrivate->propertyCacheForType(property->propType);
- if (!groupObjectPropertyCache) {
- recordError(binding->location, tr("Invalid grouped property access"));
- return false;
- }
-
void *argv[1] = { &groupObject };
QMetaObject::metacall(_qobject, QMetaObject::ReadProperty, property->coreIndex, argv);
if (!groupObject) {
return false;
}
+ if (QQmlData *groupDeclarativeData = QQmlData::get(groupObject))
+ groupObjectPropertyCache = groupDeclarativeData->propertyCache;
+ if (!groupObjectPropertyCache)
+ groupObjectPropertyCache = enginePrivate->propertyCacheForType(property->propType);
+ if (!groupObjectPropertyCache) {
+ recordError(binding->location, tr("Invalid grouped property access"));
+ return false;
+ }
+
+
bindingTarget = groupObject;
}
vmeMetaObject = new QQmlVMEMetaObject(_qobject, _propertyCache, reinterpret_cast<const QQmlVMEMetaData*>(data.constData()));
if (_ddata->propertyCache)
_ddata->propertyCache->release();
+ Q_ASSERT(installPropertyCache);
scopeObjectProtector = _ddata->jsWrapper.value();
} else {
vmeMetaObject = QQmlVMEMetaObject::get(_qobject);
void customParserBindingScopes();
void customParserEvaluateEnum();
+ void preservePropertyCacheOnGroupObjects();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
QVERIFY(!o.isNull());
}
+void tst_qqmllanguage::preservePropertyCacheOnGroupObjects()
+{
+ QQmlComponent component(&engine, testFile("preservePropertyCacheOnGroupObjects.qml"));
+ VERIFY_ERRORS(0);
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+ QObject *subObject = qvariant_cast<QObject*>(o->property("subObject"));
+ QVERIFY(subObject);
+ QCOMPARE(subObject->property("value").toInt(), 42);
+
+ QQmlData *ddata = QQmlData::get(subObject);
+ QVERIFY(ddata);
+ QQmlPropertyCache *subCache = ddata->propertyCache;
+ QVERIFY(subCache);
+ QQmlPropertyData *pd = subCache->property(QStringLiteral("newProperty"), /*object*/0, /*context*/0);
+ QVERIFY(pd);
+ QCOMPARE(pd->propType, qMetaTypeId<int>());
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"