diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-08-18 07:59:31 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-08-18 07:59:31 (GMT) |
commit | 223746067a9a1b3f5c6195868b5e510311608ca1 (patch) | |
tree | f8dfc604a035075e4a7e6d20e0930a6c6cfc4db8 /src/declarative/qml/qmlmetaproperty.cpp | |
parent | e4fad48d5e5ac227381bb9fba05dfb31a8338ed5 (diff) | |
download | Qt-223746067a9a1b3f5c6195868b5e510311608ca1.zip Qt-223746067a9a1b3f5c6195868b5e510311608ca1.tar.gz Qt-223746067a9a1b3f5c6195868b5e510311608ca1.tar.bz2 |
Resolve attached property typenames in correct context.
The imports of the component containing the reference to the
attached property are used to resolve typenames, rather than
assuming "Qt" namespace.
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; |