diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-20 12:45:31 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-26 17:58:09 +0100 |
commit | 08abb22443078dcd69cec98ea451a0e2e190982f (patch) | |
tree | c70b150ba7faf29f9b18dcb5e97b3ad0e0678633 /src/qml/qml/qqmltypecompiler.cpp | |
parent | e6b45a2f5dad8105a8f493e2167988a95c1f08ed (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/qqmltypecompiler.cpp')
-rw-r--r-- | src/qml/qml/qqmltypecompiler.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp index a5660e2d53..b39aa174a3 100644 --- a/src/qml/qml/qqmltypecompiler.cpp +++ b/src/qml/qml/qqmltypecompiler.cpp @@ -542,7 +542,7 @@ bool QQmlEnumTypeResolver::resolveEnumBindings() if (!pd) continue; - if (!pd->isEnum() && pd->propType() != QMetaType::Int) + if (!pd->isEnum() && pd->propType().id() != QMetaType::Int) continue; if (!tryQualifiedEnumAssignment(obj, propertyCache, pd, binding)) @@ -564,7 +564,7 @@ bool QQmlEnumTypeResolver::assignEnumToBinding(QmlIR::Binding *binding, QStringV bool QQmlEnumTypeResolver::tryQualifiedEnumAssignment(const QmlIR::Object *obj, const QQmlPropertyCache *propertyCache, const QQmlPropertyData *prop, QmlIR::Binding *binding) { - bool isIntProp = (prop->propType() == QMetaType::Int) && !prop->isEnum(); + bool isIntProp = (prop->propType().id() == QMetaType::Int) && !prop->isEnum(); if (!prop->isEnum() && !isIntProp) return true; @@ -763,7 +763,7 @@ QQmlScriptStringScanner::QQmlScriptStringScanner(QQmlTypeCompiler *typeCompiler) void QQmlScriptStringScanner::scan() { - const int scriptStringMetaType = qMetaTypeId<QQmlScriptString>(); + const QMetaType scriptStringMetaType = QMetaType::fromType<QQmlScriptString>(); for (int i = 0; i < qmlObjects.count(); ++i) { QQmlPropertyCache *propertyCache = propertyCaches->at(i); if (!propertyCache) @@ -854,8 +854,8 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI // Otherwise, make sure we look up by metaobject. // TODO: Is this correct? QQmlPropertyCache *pc = pd->typeVersion().hasMinorVersion() - ? enginePrivate->rawPropertyCacheForType(pd->propType(), pd->typeVersion()) - : enginePrivate->rawPropertyCacheForType(pd->propType()); + ? enginePrivate->rawPropertyCacheForType(pd->propType().id(), pd->typeVersion()) + : enginePrivate->rawPropertyCacheForType(pd->propType().id()); const QMetaObject *mo = pc ? pc->firstCppMetaObject() : nullptr; while (mo) { if (mo == &QQmlComponent::staticMetaObject) @@ -1184,7 +1184,7 @@ QQmlComponentAndAliasResolver::resolveAliasesInObject(int objectIndex, propIdx = QQmlPropertyIndex(targetProperty->coreIndex()); if (!subProperty.isEmpty()) { - const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(targetProperty->propType()); + const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(targetProperty->propType().id()); if (!valueTypeMetaObject) { // could be a deep alias bool isDeepAlias = subProperty.at(0).isLower(); |