{
}
-void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQml::QmlObject *obj, int objectIndex)
+void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQml::QmlObject *obj, QQmlPropertyCache *propertyCache)
{
- QQmlPropertyCache *propertyCache = propertyCaches.value(objectIndex);
- if (!propertyCache)
- return;
-
PropertyResolver propertyResolver(propertyCache);
QQmlPropertyData *defaultProperty = obj->indexOfDefaultProperty != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
const int objCountWithoutSynthesizedComponents = qmlObjects->count();
for (int i = 0; i < objCountWithoutSynthesizedComponents; ++i) {
const QtQml::QmlObject *obj = qmlObjects->at(i);
- if (obj->inheritedTypeNameIndex == 0)
+ QQmlPropertyCache *cache = propertyCaches.value(i);
+ if (obj->inheritedTypeNameIndex == 0 && !cache)
continue;
- QQmlCompiledData::TypeReference *tref = resolvedTypes->value(obj->inheritedTypeNameIndex);
- Q_ASSERT(tref);
- if (!tref->type || tref->type->metaObject() != &QQmlComponent::staticMetaObject) {
- findAndRegisterImplicitComponents(obj, i);
+ bool isExplicitComponent = false;
+
+ if (obj->inheritedTypeNameIndex) {
+ QQmlCompiledData::TypeReference *tref = resolvedTypes->value(obj->inheritedTypeNameIndex);
+ Q_ASSERT(tref);
+ if (tref->type && tref->type->metaObject() == &QQmlComponent::staticMetaObject)
+ isExplicitComponent = true;
+ }
+ if (!isExplicitComponent) {
+ findAndRegisterImplicitComponents(obj, cache);
continue;
}
Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT)
Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT)
+ Q_PROPERTY(MyTypeObject *selfGroupProperty READ selfGroupProperty)
+
public:
MyTypeObject()
: objectPropertyValue(0), componentPropertyValue(0) {}
MyGroupedObject *nullGrouped() { return 0; }
+ MyTypeObject *selfGroupProperty() { return this; }
+
void doAction() { emit action(); }
signals:
void action();
void dynamicSignalsAndSlots();
void simpleBindings();
void autoComponentCreation();
+ void autoComponentCreationInGroupProperty();
void propertyValueSource();
void attachedProperties();
void dynamicObjects();
QCOMPARE(child->realProperty(), qreal(9));
}
+void tst_qqmllanguage::autoComponentCreationInGroupProperty()
+{
+ QQmlComponent component(&engine, testFileUrl("autoComponentCreationInGroupProperties.qml"));
+ VERIFY_ERRORS(0);
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->componentProperty() != 0);
+ MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create());
+ QVERIFY(child != 0);
+ QCOMPARE(child->realProperty(), qreal(9));
+}
+
void tst_qqmllanguage::propertyValueSource()
{
{