summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-03-04 09:47:36 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-03-04 09:47:36 (GMT)
commita99fe8624a25f8a09fe9b3234306a4d8b3a3f38e (patch)
tree574351218cdd58a3bae7995ff7b1c5e92698b119 /src/script/bridge
parentc7fec28e7b2f7192c6589c37f3db3e0b4ee85460 (diff)
downloadQt-a99fe8624a25f8a09fe9b3234306a4d8b3a3f38e.zip
Qt-a99fe8624a25f8a09fe9b3234306a4d8b3a3f38e.tar.gz
Qt-a99fe8624a25f8a09fe9b3234306a4d8b3a3f38e.tar.bz2
QScript: Test against QMetaType::QVariant instead of against the string
now that QVariant is known to QMetaType, we can test for the metatype id instead of doing string comparison Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptqobject.cpp37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 39ba935..91636da 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -523,19 +523,15 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c
QByteArray returnTypeName = method.typeName();
int rtype = QMetaType::type(returnTypeName);
if ((rtype == 0) && !returnTypeName.isEmpty()) {
- if (returnTypeName == "QVariant") {
- types.append(QScriptMetaType::variant());
- } else {
- int enumIndex = indexOfMetaEnum(meta, returnTypeName);
- if (enumIndex != -1)
- types.append(QScriptMetaType::metaEnum(enumIndex, returnTypeName));
- else
- types.append(QScriptMetaType::unresolved(returnTypeName));
- }
+ int enumIndex = indexOfMetaEnum(meta, returnTypeName);
+ if (enumIndex != -1)
+ types.append(QScriptMetaType::metaEnum(enumIndex, returnTypeName));
+ else
+ types.append(QScriptMetaType::unresolved(returnTypeName));
} else {
if (callType == QMetaMethod::Constructor)
types.append(QScriptMetaType::metaType(QMetaType::QObjectStar, "QObject*"));
- else if (returnTypeName == "QVariant")
+ else if (rtype == QMetaType::QVariant)
types.append(QScriptMetaType::variant());
else
types.append(QScriptMetaType::metaType(rtype, returnTypeName));
@@ -547,20 +543,15 @@ static JSC::JSValue callQtMethod(JSC::ExecState *exec, QMetaMethod::MethodType c
QByteArray argTypeName = parameterTypeNames.at(i);
int atype = QMetaType::type(argTypeName);
if (atype == 0) {
- if (argTypeName == "QVariant") {
- types.append(QScriptMetaType::variant());
- } else {
- int enumIndex = indexOfMetaEnum(meta, argTypeName);
- if (enumIndex != -1)
- types.append(QScriptMetaType::metaEnum(enumIndex, argTypeName));
- else
- types.append(QScriptMetaType::unresolved(argTypeName));
- }
- } else {
- if (argTypeName == "QVariant")
- types.append(QScriptMetaType::variant());
+ int enumIndex = indexOfMetaEnum(meta, argTypeName);
+ if (enumIndex != -1)
+ types.append(QScriptMetaType::metaEnum(enumIndex, argTypeName));
else
- types.append(QScriptMetaType::metaType(atype, argTypeName));
+ types.append(QScriptMetaType::unresolved(argTypeName));
+ } else if (atype == QMetaType::QVariant) {
+ types.append(QScriptMetaType::variant());
+ } else {
+ types.append(QScriptMetaType::metaType(atype, argTypeName));
}
}