summaryrefslogtreecommitdiffstats
path: root/src/script/api/qscriptengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/api/qscriptengine.cpp')
-rw-r--r--src/script/api/qscriptengine.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 9cd5c63..47c5262 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2901,6 +2901,9 @@ JSC::JSValue QScriptEnginePrivate::create(JSC::ExecState *exec, int type, const
result = eng->newQObject(*reinterpret_cast<QObject* const *>(ptr));
break;
#endif
+ case QMetaType::QVariant:
+ result = jscValueFromVariant(exec, *reinterpret_cast<const QVariant*>(ptr));
+ break;
default:
if (type == qMetaTypeId<QScriptValue>()) {
result = eng->scriptValueToJSCValue(*reinterpret_cast<const QScriptValue*>(ptr));
@@ -2922,8 +2925,6 @@ JSC::JSValue QScriptEnginePrivate::create(JSC::ExecState *exec, int type, const
else {
QByteArray typeName = QMetaType::typeName(type);
- if (typeName == "QVariant")
- result = jscValueFromVariant(exec, *reinterpret_cast<const QVariant*>(ptr));
if (typeName.endsWith('*') && !*reinterpret_cast<void* const *>(ptr))
return JSC::jsNull();
else
@@ -3046,6 +3047,9 @@ bool QScriptEnginePrivate::convertValue(JSC::ExecState *exec, JSC::JSValue value
*reinterpret_cast<QVariantMap *>(ptr) = variantMapFromObject(exec, value);
return true;
} break;
+ case QMetaType::QVariant:
+ *reinterpret_cast<QVariant*>(ptr) = toVariant(exec, value);
+ return true;
default:
;
}
@@ -3096,9 +3100,6 @@ bool QScriptEnginePrivate::convertValue(JSC::ExecState *exec, JSC::JSValue value
return false;
*reinterpret_cast<QScriptValue*>(ptr) = eng->scriptValueFromJSCValue(value);
return true;
- } else if (name == "QVariant") {
- *reinterpret_cast<QVariant*>(ptr) = toVariant(exec, value);
- return true;
}
// lazy registration of some common list types