aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2019-04-07 15:47:56 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-11-26 17:57:45 +0100
commit2bbd21c097e3456919b238df3476d0a38846b9a7 (patch)
treeae5fdc064ec68d383b99a5b523737a88f0d836c5 /src/qml/jsruntime
parentb897d69cf7071eb53432ded62fdc80a2a6258e98 (diff)
Remove hack to get the methodCount of a metaobject
Instead use the proper private API from Qt Core. Task-number: QTBUG-82931 Change-Id: Ia460350941f07ff749013fb29621460074d57a7d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 1bf3a01f03..7f2da462b5 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1494,19 +1494,6 @@ static int MatchScore(const QV4::Value &actual, int conversionType)
}
}
-static inline int QMetaObject_methods(const QMetaObject *metaObject)
-{
- struct Private
- {
- int revision;
- int className;
- int classInfoCount, classInfoData;
- int methodCount, methodData;
- };
-
- return reinterpret_cast<const Private *>(metaObject->d.data)->methodCount;
-}
-
/*
Returns the next related method, if one, or 0.
*/
@@ -1524,11 +1511,11 @@ static const QQmlPropertyData * RelatedMethod(const QQmlObjectOrGadget &object,
return propertyCache->method(current->overrideIndex());
} else {
const QMetaObject *mo = object.metaObject();
- int methodOffset = mo->methodCount() - QMetaObject_methods(mo);
+ int methodOffset = mo->methodOffset();
while (methodOffset > current->overrideIndex()) {
mo = mo->superClass();
- methodOffset -= QMetaObject_methods(mo);
+ methodOffset -= QMetaObjectPrivate::get(mo)->methodCount;
}
// If we've been called before with the same override index, then
@@ -1544,7 +1531,7 @@ static const QQmlPropertyData * RelatedMethod(const QQmlObjectOrGadget &object,
for (int ii = current->overrideIndex() - 1; ii >= methodOffset; --ii) {
if (methodName == mo->method(ii).name()) {
dummy.setOverload(true);
- dummy.setOverrideIndexIsProperty(0);
+ dummy.setOverrideIndexIsProperty(false);
dummy.setOverrideIndex(ii);
return &dummy;
}
@@ -2178,7 +2165,7 @@ ReturnedValue QObjectMethod::callInternal(const Value *thisObject, const Value *
for (int ii = d()->index - 1; ii >= methodOffset; --ii) {
if (methodName == mo->method(ii).name()) {
method.setOverload(true);
- method.setOverrideIndexIsProperty(0);
+ method.setOverrideIndexIsProperty(false);
method.setOverrideIndex(ii);
break;
}