diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-12-17 08:14:25 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-12-17 08:14:25 (GMT) |
commit | b6849d90388ffd415d398923ce8f8d5d8d549bd6 (patch) | |
tree | 4d210d5bbec19406749e8e66fc535cf1b0500dea /src/declarative | |
parent | f79e0e89ea9061bbe93f43405a1ec954a41da1cc (diff) | |
parent | fd222fa269db8797ad35c23d7298df7c8a81751e (diff) | |
download | Qt-b6849d90388ffd415d398923ce8f8d5d8d549bd6.zip Qt-b6849d90388ffd415d398923ce8f8d5d8d549bd6.tar.gz Qt-b6849d90388ffd415d398923ce8f8d5d8d549bd6.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 15 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 10 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine_p.h | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlpropertycache.cpp | 7 | ||||
-rw-r--r-- | src/declarative/qml/qmlpropertycache_p.h | 2 |
5 files changed, 31 insertions, 4 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index bd46bbe..9147c4a 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -2440,6 +2440,21 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder, typeName = aliasProperty.typeName(); } else { typeName = idObject->metaObject()->className(); + + //use the base type since it has been registered with metatype system + int index = typeName.indexOf("_QML_"); + if (index != -1) { + typeName = typeName.left(index); + } else { + index = typeName.indexOf("_QMLTYPE_"); + const QMetaObject *mo = idObject->metaObject(); + while (index != -1 && mo) { + typeName = mo->superClass()->className(); + index = typeName.indexOf("_QMLTYPE_"); + mo = mo->superClass(); + } + } + typeName += '*'; } diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 6b66095..f541631 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -1527,6 +1527,16 @@ int QmlEnginePrivate::qmlListType(int t) const return QmlMetaType::qmlListType(t); } +QmlMetaType::TypeCategory QmlEnginePrivate::typeCategory(int t) const +{ + if (m_compositeTypes.contains(t)) + return QmlMetaType::Object; + else if (m_qmlLists.contains(t)) + return QmlMetaType::QmlList; + else + return QmlMetaType::typeCategory(t); +} + const QMetaObject *QmlEnginePrivate::rawMetaObjectForType(int t) const { QHash<int, QmlCompiledData*>::ConstIterator iter = m_compositeTypes.find(t); diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index c3db6cf..96297ea 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -263,6 +263,7 @@ public: bool isQmlList(int) const; bool isObject(int); int qmlListType(int) const; + QmlMetaType::TypeCategory typeCategory(int) const; const QMetaObject *rawMetaObjectForType(int) const; const QMetaObject *metaObjectForType(int) const; QHash<int, int> m_qmlLists; diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 6ba6028..bc7d7de 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE Q_DECLARE_METATYPE(QScriptValue); -void QmlPropertyCache::Data::load(const QMetaProperty &p) +void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine) { propType = p.userType(); if (QVariant::Type(propType) == QVariant::LastType) @@ -69,7 +69,8 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p) } else if (p.isEnumType()) { flags |= Data::IsEnumType; } else { - QmlMetaType::TypeCategory cat = QmlMetaType::typeCategory(propType); + QmlMetaType::TypeCategory cat = engine ? QmlEnginePrivate::get(engine)->typeCategory(propType) + : QmlMetaType::typeCategory(propType); if (cat == QmlMetaType::Object) flags |= Data::IsQObjectDerived; else if (cat == QmlMetaType::List) @@ -174,7 +175,7 @@ void QmlPropertyCache::update(QmlEngine *engine, const QMetaObject *metaObject) RData *data = new RData; data->identifier = enginePriv->objectClass->createPersistentIdentifier(propName); - data->load(p); + data->load(p, engine); indexCache[ii] = data; diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h index 613f4dd..50b4cf2 100644 --- a/src/declarative/qml/qmlpropertycache_p.h +++ b/src/declarative/qml/qmlpropertycache_p.h @@ -97,7 +97,7 @@ public: int coreIndex; int notifyIndex; - void load(const QMetaProperty &); + void load(const QMetaProperty &, QmlEngine *engine = 0); void load(const QMetaMethod &); QString name(QObject *); QString name(const QMetaObject *); |