aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetaobject.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-11-20 12:45:31 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-11-26 17:58:09 +0100
commit08abb22443078dcd69cec98ea451a0e2e190982f (patch)
treec70b150ba7faf29f9b18dcb5e97b3ad0e0678633 /src/qml/qml/qqmlmetaobject.cpp
parente6b45a2f5dad8105a8f493e2167988a95c1f08ed (diff)
QML engine: Use QMetaType instead of metatype-id in propertydata
We don't want to convert back and forth between QMetaTypes and ids. This change is the first step towards using QMetaType directly everywhere. By reordering the members of QQmlPropertyData to avoid a gap caused by alignment, we can replace the typeid int with a QMetaType without requiring more space. There are still a few places left using metatype ids, notably the value type logic. Task-number: QTBUG-82931 Change-Id: Ic38f38d10c71ed20655877976c9cb5ee3cbe2d77 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetaobject.cpp')
-rw-r--r--src/qml/qml/qqmlmetaobject.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlmetaobject.cpp b/src/qml/qml/qqmlmetaobject.cpp
index 84a906b4f9..89c08f3841 100644
--- a/src/qml/qml/qqmlmetaobject.cpp
+++ b/src/qml/qml/qqmlmetaobject.cpp
@@ -139,32 +139,32 @@ int QQmlMetaObject::methodReturnType(const QQmlPropertyData &data, QByteArray *u
{
Q_ASSERT(_m && data.coreIndex() >= 0);
- int type = data.propType();
+ QMetaType type = data.propType();
const char *propTypeName = nullptr;
- if (type == QMetaType::UnknownType) {
+ if (!type.isValid()) {
// Find the return type name from the method info
QMetaMethod m = _m->method(data.coreIndex());
- type = m.returnType();
+ type = m.returnMetaType();
propTypeName = m.typeName();
}
- if (QMetaType(type).sizeOf() <= qsizetype(sizeof(int))) {
- if (QMetaType(type).flags() & QMetaType::IsEnumeration)
+ if (type.sizeOf() <= qsizetype(sizeof(int))) {
+ if (type.flags() & QMetaType::IsEnumeration)
return QMetaType::Int;
if (isNamedEnumerator(_m, propTypeName))
return QMetaType::Int;
- if (type == QMetaType::UnknownType) {
+ if (!type.isValid()) {
if (unknownTypeError)
*unknownTypeError = propTypeName;
}
} // else we know that it's a known type, as sizeOf(UnknownType) == 0
- return type;
+ return type.id();
}
int *QQmlMetaObject::methodParameterTypes(int index, ArgTypeStorage *argStorage,