diff options
author | Erik Verbruggen <erik.verbruggen@qt.io> | 2016-08-08 11:24:04 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-08-17 14:05:31 +0000 |
commit | 82e551b5fa321612cb155a450d3e0ec76a63fd45 (patch) | |
tree | 7346bf3e9fa76cce166f8139d67f280f3dae1799 /src/qml/qml/qqmlpropertycache.cpp | |
parent | a86e6e1821da51065b2fb3392c23da17e6e13f97 (diff) |
QML: Get rid of propTypeName in QQmlPropertyRawData
This information can be recreated when needed: the property/method index
is known, just like the meta-object, so we can query that for the
type name.
Change-Id: I9d4f557eda4e4a946a80b68d3787823767b0b1d3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertycache.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index af9b8cc045..7cb1425725 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -161,7 +161,6 @@ void QQmlPropertyData::lazyLoad(const QMetaProperty &p) _flags.type = Flags::QVariantType; } else if (type == QVariant::UserType || type == -1) { _flags.notFullyResolved = true; - setPropTypeName(p.typeName()); } else { setPropType(type); } @@ -224,7 +223,6 @@ void QQmlPropertyData::lazyLoad(const QMetaMethod &m) if (!returnType) returnType = "\0"; if ((*returnType != 'v') || (qstrcmp(returnType+1, "oid") != 0)) { - setPropTypeName(returnType); _flags.notFullyResolved = true; } @@ -691,13 +689,22 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, void QQmlPropertyCache::resolve(QQmlPropertyData *data) const { Q_ASSERT(data->notFullyResolved()); - - data->setPropType(QMetaType::type(data->propTypeName())); data->_flags.notFullyResolved = false; + const QMetaObject *mo = firstCppMetaObject(); + if (data->isFunction()) { + auto metaMethod = mo->method(data->coreIndex()); + const char *retTy = metaMethod.typeName(); + if (!retTy) + retTy = "\0"; + data->setPropType(QMetaType::type(retTy)); + } else { + auto metaProperty = mo->property(data->coreIndex()); + data->setPropType(QMetaType::type(metaProperty.typeName())); + } + if (!data->isFunction()) { if (data->propType() == QMetaType::UnknownType) { - const QMetaObject *mo = _metaObject; QQmlPropertyCache *p = _parent; while (p && (!mo || _ownMetaObject)) { mo = p->_metaObject; |