diff options
Diffstat (limited to 'src/declarative/qml/qmlmetaproperty.cpp')
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index c1736cb..e69746e 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -41,6 +41,7 @@ #include "qmlmetaproperty.h" #include "qmlmetaproperty_p.h" +#include "qmlcompositetypedata_p.h" #include <qml.h> #include <private/qfxperf_p.h> #include <QStringList> @@ -216,14 +217,19 @@ void QmlMetaPropertyPrivate::initProperty(QObject *obj, const QString &name) if (name.isEmpty() || !obj) return; - if (name.at(0).isUpper()) { + if (enginePrivate && name.at(0).isUpper()) { // Attached property - // XXX name should be resolved with QmlEngine::resolveType(), not like this! - QmlType *t = QmlMetaType::qmlType("Qt/"+name.toLatin1(),-1,-1); - if (t && t->attachedPropertiesFunction()) { - attachedFunc = t->index(); - if (attachedFunc != -1) - type = QmlMetaProperty::Property | QmlMetaProperty::Attached; + QmlCompositeTypeData *typeData = + enginePrivate->typeManager.get(context->baseUrl()); + + if (typeData) { + QmlType *t = 0; + enginePrivate->resolveType(typeData->imports, name.toLatin1(), &t, 0); + if (t && t->attachedPropertiesFunction()) { + attachedFunc = t->index(); + if (attachedFunc != -1) + type = QmlMetaProperty::Property | QmlMetaProperty::Attached; + } } return; |