aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-02-08 14:07:01 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-02-08 15:10:44 +0100
commit461197292ad0462dee03ec03bcf1f2d61a300ebc (patch)
tree7296011606bbd557ef1fa3db9c789821c0278e32 /src/qml
parent40eaa9509b1c2e430b7617e1b42aa66214ad80df (diff)
QQmlInterceptorMetaObject::intercept: Avoid metatype<->id ping-pong
There is no need to extract the metatype id to know whether the type is valid (aka != UnknownType). Moreover, as we already have a metatype, there is no need to do the typeid -> metatype lookup. Task-number: QTBUG-88766 Change-Id: I5f9512aa6e06b0d89be8d3cad970f12319dab156 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index bea8fc06f7..61ae1d4a06 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -322,9 +322,8 @@ bool QQmlInterceptorMetaObject::intercept(QMetaObject::Call c, int id, void **a)
const int valueIndex = vi->m_propertyIndex.valueTypeIndex();
const QQmlData *data = QQmlData::get(object);
const QMetaType metaType = data->propertyCache->property(id)->propType();
- const int type = metaType.id();
- if (type != QMetaType::UnknownType) {
+ if (metaType.isValid()) {
if (valueIndex != -1) {
QQmlGadgetPtrWrapper *valueType = QQmlGadgetPtrWrapper::instance(
data->context->engine(), metaType);
@@ -362,7 +361,7 @@ bool QQmlInterceptorMetaObject::intercept(QMetaObject::Call c, int id, void **a)
//
QMetaProperty valueProp = valueType->property(valueIndex);
- QVariant newValue(QMetaType(type), a[0]);
+ QVariant newValue(metaType, a[0]);
valueType->read(object, id);
QVariant prevComponentValue = valueProp.read(valueType);
@@ -383,7 +382,7 @@ bool QQmlInterceptorMetaObject::intercept(QMetaObject::Call c, int id, void **a)
if (updated)
return true;
} else {
- vi->write(QVariant(QMetaType(type), a[0]));
+ vi->write(QVariant(metaType, a[0]));
return true;
}
}