aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp2
-rw-r--r--src/qml/qml/qqmlmetaobject.cpp32
-rw-r--r--src/qml/qml/qqmlmetaobject_p.h2
3 files changed, 11 insertions, 25 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 4a7a80d3bf..714e07cbad 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1565,7 +1565,7 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ
{
QByteArray unknownTypeError;
- int returnType = object.methodReturnType(data, &unknownTypeError);
+ int returnType = object.methodReturnType(data, &unknownTypeError).id();
if (returnType == QMetaType::UnknownType) {
return engine->throwError(QLatin1String("Unknown method return type: ")
diff --git a/src/qml/qml/qqmlmetaobject.cpp b/src/qml/qml/qqmlmetaobject.cpp
index 89c08f3841..471868a91d 100644
--- a/src/qml/qml/qqmlmetaobject.cpp
+++ b/src/qml/qml/qqmlmetaobject.cpp
@@ -135,36 +135,22 @@ void QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(QMetaObject::Call type,
*index -= offset;
}
-int QQmlMetaObject::methodReturnType(const QQmlPropertyData &data, QByteArray *unknownTypeError) const
+QMetaType QQmlMetaObject::methodReturnType(const QQmlPropertyData &data, QByteArray *unknownTypeError) const
{
Q_ASSERT(_m && data.coreIndex() >= 0);
QMetaType type = data.propType();
-
- const char *propTypeName = nullptr;
-
if (!type.isValid()) {
// Find the return type name from the method info
- QMetaMethod m = _m->method(data.coreIndex());
-
- type = m.returnMetaType();
- propTypeName = m.typeName();
+ type = _m->method(data.coreIndex()).returnMetaType();
}
-
- if (type.sizeOf() <= qsizetype(sizeof(int))) {
- if (type.flags() & QMetaType::IsEnumeration)
- return QMetaType::Int;
-
- if (isNamedEnumerator(_m, propTypeName))
- return QMetaType::Int;
-
- if (!type.isValid()) {
- if (unknownTypeError)
- *unknownTypeError = propTypeName;
- }
- } // else we know that it's a known type, as sizeOf(UnknownType) == 0
-
- return type.id();
+ if (type.flags().testFlag(QMetaType::IsEnumeration))
+ type = QMetaType::fromType<int>();
+ if (type.isValid())
+ return type;
+ else if (unknownTypeError)
+ *unknownTypeError = _m->method(data.coreIndex()).typeName();
+ return QMetaType();
}
int *QQmlMetaObject::methodParameterTypes(int index, ArgTypeStorage *argStorage,
diff --git a/src/qml/qml/qqmlmetaobject_p.h b/src/qml/qml/qqmlmetaobject_p.h
index 9465458780..61e3e16a81 100644
--- a/src/qml/qml/qqmlmetaobject_p.h
+++ b/src/qml/qml/qqmlmetaobject_p.h
@@ -89,7 +89,7 @@ public:
inline const QMetaObject *metaObject() const;
- int methodReturnType(const QQmlPropertyData &data, QByteArray *unknownTypeError) const;
+ QMetaType methodReturnType(const QQmlPropertyData &data, QByteArray *unknownTypeError) const;
int *methodParameterTypes(int index, ArgTypeStorage *argStorage,
QByteArray *unknownTypeError) const;
int *constructorParameterTypes(int index, ArgTypeStorage *dummy, QByteArray *unknownTypeError) const;