From dd652f37353a01e0172e20f1e7ef24b001a281db Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Thu, 23 Jul 2009 15:44:45 +1000 Subject: Temporary fix for Attached properties and correct fix for Qt/4.6/Component reference. Attached properties should be resolved like other types (i.e. through the QmlEngine::resolveType functions), otherwise non-Qt attached properties will not work, and constructs like this will not work: Wrapper.Qt.PathView.scale --- src/declarative/qml/qmlcompiler.cpp | 6 +++--- src/declarative/qml/qmlmetatype.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 477e6a5..3d38311 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -1011,7 +1011,7 @@ bool QmlCompiler::buildSubObject(Object *obj, const BindingContext &ctxt) int QmlCompiler::componentTypeRef() { - QmlType *t = QmlMetaType::qmlType("Component"); + QmlType *t = QmlMetaType::qmlType("Qt/4.6/Component"); for (int ii = output->types.count() - 1; ii >= 0; --ii) { if (output->types.at(ii).type == t) return ii; @@ -1123,7 +1123,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop, COMPILE_EXCEPTION(prop, "Attached properties cannot be used here"); } - QmlType *type = QmlMetaType::qmlType(prop->name); + QmlType *type = QmlMetaType::qmlType("Qt/4.6/"+prop->name); // XXX Should not hard-code namespace if (!type || !type->attachedPropertiesType()) COMPILE_EXCEPTION(prop, "Non-existant attached object"); @@ -1394,7 +1394,7 @@ bool QmlCompiler::buildAttachedProperty(QmlParser::Property *prop, const BindingContext &ctxt) { Q_ASSERT(prop->value); - int id = QmlMetaType::attachedPropertiesFuncId(prop->name); + int id = QmlMetaType::attachedPropertiesFuncId("Qt/4.6/"+prop->name); // XXX Should not hard-code namespace Q_ASSERT(id != -1); // This is checked in compileProperty() prop->index = id; diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp index f65ead8..3552b44 100644 --- a/src/declarative/qml/qmlmetatype.cpp +++ b/src/declarative/qml/qmlmetatype.cpp @@ -675,7 +675,7 @@ int QmlMetaType::attachedPropertiesFuncId(const QByteArray &name) QReadLocker lock(metaTypeDataLock()); QmlMetaTypeData *data = metaTypeData(); - QmlType *type = data->nameToType.value(name); + QmlType *type = data->nameToType.value("Qt/4.6/"+name); // XXX Should not hard-code namespace if (type && type->attachedPropertiesFunction()) return type->index(); else -- cgit v0.12