summaryrefslogtreecommitdiff
path: root/src/script/bridge/qscriptqobject.cpp
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2020-12-19 14:41:03 +0100
committerIvan Komissarov <abbapoh@gmail.com>2021-02-07 22:49:18 +0100
commit70bc5beca051939f81dbdec3a5082241102065fa (patch)
tree6dc711ce2ee4ec24a7993e05341ab47cc44e62ce /src/script/bridge/qscriptqobject.cpp
parentadf8ba14c3e54abc971443ca0d6e121a9d4671cb (diff)
downloadqtscript-70bc5beca051939f81dbdec3a5082241102065fa.tar.gz
Add createVariant function
...to work around changed QVariant's ctor signature Change-Id: I3c7d9dc7d64a2ee609fbf10ee9527a5fe0a24f9c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/script/bridge/qscriptqobject.cpp')
-rw-r--r--src/script/bridge/qscriptqobject.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 44568d6..7ed9612 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -49,6 +49,7 @@
#include "../api/qscriptcontext_p.h"
#include "qscriptfunction_p.h"
#include "qscriptactivationobject_p.h"
+#include "qscriptvariant_p.h"
#include "Error.h"
#include "PrototypeFunction.h"
@@ -551,7 +552,7 @@ static JSC::JSValue delegateQtMethod(JSC::ExecState *exec, QMetaMethod::MethodTy
if (rtype != QMetaType::Void) {
// initialize the result
- args[0] = QVariant(rtype, (void *)0);
+ args[0] = createQVariant(rtype, nullptr);
}
// try to convert arguments
@@ -567,7 +568,7 @@ static JSC::JSValue delegateQtMethod(JSC::ExecState *exec, QMetaMethod::MethodTy
int tid = -1;
QVariant v;
if (argType.isUnresolved()) {
- v = QVariant(QMetaType::QObjectStar, (void *)0);
+ v = createQVariant(QMetaType::QObjectStar, nullptr);
converted = QScriptEnginePrivate::convertToNativeQObject(
exec, actual, argType.name(), reinterpret_cast<void* *>(v.data()));
} else if (argType.isVariant()) {
@@ -579,7 +580,7 @@ static JSC::JSValue delegateQtMethod(JSC::ExecState *exec, QMetaMethod::MethodTy
}
} else {
tid = argType.typeId();
- v = QVariant(tid, (void *)0);
+ v = createQVariant(tid, nullptr);
converted = QScriptEnginePrivate::convertValue(exec, actual, tid, v.data());
if (exec->hadException())
return exec->exception();
@@ -599,7 +600,7 @@ static JSC::JSValue delegateQtMethod(JSC::ExecState *exec, QMetaMethod::MethodTy
QByteArray vvTypeName = vv.typeName();
if (vvTypeName.endsWith('*')
&& (vvTypeName.left(vvTypeName.size()-1) == argType.name())) {
- v = QVariant(tid, *reinterpret_cast<void* *>(vv.data()));
+ v = createQVariant(tid, *reinterpret_cast<void* *>(vv.data()));
converted = true;
matchDistance += 10;
}
@@ -939,7 +940,7 @@ struct QtMethodCaller
} else if (retType.typeId() != QMetaType::Void) {
result = QScriptEnginePrivate::create(exec, retType.typeId(), params[0]);
if (!result)
- result = engine->newVariant(QVariant(retType.typeId(), params[0]));
+ result = engine->newVariant(createQVariant((retType.typeId()), params[0]));
} else {
result = JSC::jsUndefined();
}