diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-01 03:25:49 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-05 02:39:05 (GMT) |
commit | 69c58d7e1c5713d1d6badeffc6c45eeacb1ba2d8 (patch) | |
tree | d060f3f7a76a7952f37196a2f50ad91b667a465d /src/declarative/qml/qmlpropertycache.cpp | |
parent | 99cf375f554fe01cf47fd4e1a291d4bba62b4018 (diff) | |
download | Qt-69c58d7e1c5713d1d6badeffc6c45eeacb1ba2d8.zip Qt-69c58d7e1c5713d1d6badeffc6c45eeacb1ba2d8.tar.gz Qt-69c58d7e1c5713d1d6badeffc6c45eeacb1ba2d8.tar.bz2 |
QmlMetaProperty cleanup
Diffstat (limited to 'src/declarative/qml/qmlpropertycache.cpp')
-rw-r--r-- | src/declarative/qml/qmlpropertycache.cpp | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 95b819a..7d234fd 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -40,10 +40,48 @@ ****************************************************************************/ #include "qmlpropertycache_p.h" -#include "qmlengine_p.h" +#include <private/qmlengine_p.h> +#include <QtDeclarative/qmlbinding.h> QT_BEGIN_NAMESPACE +void QmlPropertyCache::Data::load(const QMetaProperty &p) +{ + propType = p.userType(); + coreIndex = p.propertyIndex(); + notifyIndex = p.notifySignalIndex(); + name = QLatin1String(p.name()); + + if (p.isConstant()) + flags |= Data::IsConstant; + + if (propType == qMetaTypeId<QmlBinding *>()) { + flags |= Data::IsQmlBinding; + } else if (p.isEnumType()) { + flags |= Data::IsEnumType; + } else { + QmlMetaType::TypeCategory cat = QmlMetaType::typeCategory(propType); + if (cat == QmlMetaType::Object) + flags |= Data::IsQObjectDerived; + else if (cat == QmlMetaType::List) + flags |= Data::IsQList; + else if (cat == QmlMetaType::QmlList) + flags |= Data::IsQmlList; + } +} + +void QmlPropertyCache::Data::load(const QMetaMethod &m) +{ + name = QLatin1String(m.signature()); + int parenIdx = name.indexOf(QLatin1Char('(')); + Q_ASSERT(parenIdx != -1); + name = name.left(parenIdx); + + coreIndex = m.methodIndex(); + flags |= Data::IsFunction; +} + + QmlPropertyCache::QmlPropertyCache() { } @@ -83,15 +121,7 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject QScriptDeclarativeClass::PersistentIdentifier<RData> *data = enginePriv->objectClass->createPersistentIdentifier<RData>(propName); - data->propType = p.userType(); - data->coreIndex = ii; - data->notifyIndex = p.notifySignalIndex(); - data->name = propName; - - if (p.isConstant()) - data->flags |= Data::IsConstant; - if (QmlMetaType::isObject(data->propType)) - data->flags |= Data::IsQObjectDerived; + data->load(p); cache->indexCache[ii] = data; @@ -118,12 +148,13 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject QScriptDeclarativeClass::PersistentIdentifier<RData> *data = enginePriv->objectClass->createPersistentIdentifier<RData>(methodName); + + data->load(m); + cache->stringCache.insert(methodName, data); cache->identifierCache.insert(data->identifier, data); data->addref(); data->addref(); - - data->flags |= Data::IsFunction; } return cache; |