aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2016-08-08 11:24:04 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-08-17 14:05:31 +0000
commit82e551b5fa321612cb155a450d3e0ec76a63fd45 (patch)
tree7346bf3e9fa76cce166f8139d67f280f3dae1799 /src
parenta86e6e1821da51065b2fb3392c23da17e6e13f97 (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')
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp17
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h8
2 files changed, 13 insertions, 12 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;
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 6d3c4a8a7e..8a1f3810aa 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -177,9 +177,6 @@ public:
int propType() const { Q_ASSERT(isFullyResolved()); return _propType; }
void setPropType(int pt) { _propType = pt; }
- const char *propTypeName() const { Q_ASSERT(!isFullyResolved()); return _propTypeName; }
- void setPropTypeName(const char *ptn) { _propTypeName = ptn; }
-
int notifyIndex() const { return _notifyIndex; }
void setNotifyIndex(int idx) { _notifyIndex = idx; }
@@ -220,10 +217,7 @@ public:
void setCoreIndex(int idx) { _coreIndex = idx; }
private:
- union {
- int _propType; // When !NotFullyResolved
- const char *_propTypeName; // When NotFullyResolved
- };
+ int _propType; // When !NotFullyResolved
union {
// The notify index is in the range returned by QObjectPrivate::signalIndex().
// This is different from QMetaMethod::methodIndex().