From 98c4fb27bb930f19365395a3fd75e4c3012640cb Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 22 May 2009 16:50:10 +1000 Subject: Use the true metatype of attached properties in the compiler --- src/declarative/qml/qmlcompiler.cpp | 4 ++++ src/declarative/util/qmlpackage.cpp | 2 +- src/declarative/util/qmlpackage.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 8990732..5f92721 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -862,6 +862,10 @@ bool QmlCompiler::compileProperty(Property *prop, Object *obj, int ctxt) prop->type = t; } } + } else if(isAttachedProperty(prop->name) && prop->value) { + QmlType *type = QmlMetaType::qmlType(prop->name); + if (type && type->attachedPropertiesType()) + prop->value->metatype = type->attachedPropertiesType(); } if (prop->name == "id") { diff --git a/src/declarative/util/qmlpackage.cpp b/src/declarative/util/qmlpackage.cpp index bfad44c..107bcdb 100644 --- a/src/declarative/util/qmlpackage.cpp +++ b/src/declarative/util/qmlpackage.cpp @@ -142,7 +142,7 @@ QObject *QmlPackage::part(const QString &name) return 0; } -QObject *QmlPackage::qmlAttachedProperties(QObject *o) +QmlPackageAttached *QmlPackage::qmlAttachedProperties(QObject *o) { return new QmlPackageAttached(o); } diff --git a/src/declarative/util/qmlpackage.h b/src/declarative/util/qmlpackage.h index 3861890..f4167fd 100644 --- a/src/declarative/util/qmlpackage.h +++ b/src/declarative/util/qmlpackage.h @@ -57,6 +57,7 @@ QT_MODULE(Declarative) *****************************************************************************/ class QmlPackagePrivate; +class QmlPackageAttached; class QmlPackage : public QObject { Q_OBJECT @@ -74,7 +75,7 @@ public: QObject *part(const QString & = QString()); bool hasPart(const QString &); - static QObject *qmlAttachedProperties(QObject *); + static QmlPackageAttached *qmlAttachedProperties(QObject *); }; QML_DECLARE_TYPE(QmlPackage); -- cgit v0.12