summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlmetaproperty.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-08-18 07:59:31 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-08-18 07:59:31 (GMT)
commit223746067a9a1b3f5c6195868b5e510311608ca1 (patch)
treef8dfc604a035075e4a7e6d20e0930a6c6cfc4db8 /src/declarative/qml/qmlmetaproperty.cpp
parente4fad48d5e5ac227381bb9fba05dfb31a8338ed5 (diff)
downloadQt-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.cpp20
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;