Showing the changes to libraries/script-engine/src/qtscript/ScriptEngineQtScript.cpp (1 of 11 files). Show all
Unified · Split
| @@ -52,15 +52,9 @@ · 51 unmodified lines | ||
| 52 | 52 | #include "ScriptObjectQtProxy.h" |
| 53 | 53 | #include "ScriptProgramQtWrapper.h" |
| 54 | 54 | #include "ScriptValueQtWrapper.h" |
| 55 | −#include "ScriptContextQtAgent.h" | |
| 56 | 55 | |
| 57 | 56 | static const int MAX_DEBUG_VALUE_LENGTH { 80 }; |
| 58 | 57 | |
| 59 | −Q_DECLARE_METATYPE(QScriptEngine::FunctionSignature) | |
| 60 | −int qfunctionSignatureMetaID = qRegisterMetaType<QScriptEngine::FunctionSignature>(); | |
| 61 | − | |
| 62 | −int scriptEnginePointerMetaID = qRegisterMetaType<ScriptEngineQtScriptPointer>(); | |
| 63 | − | |
| 64 | 58 | bool ScriptEngineQtScript::IS_THREADSAFE_INVOCATION(const QThread* thread, const QString& method) { |
| 65 | 59 | const QThread* currentThread = QThread::currentThread(); |
| 66 | 60 | if (currentThread == thread) { |
| @@ -336,13 +330,6 @@ ScriptEngineQtScript::ScriptEngineQtScript(ScriptManager* scriptManager) : · 269 unmodified lines | ||
| 336 | 330 | _undefinedValue = ScriptValue(new ScriptValueQtWrapper(this, std::move(undefined))); |
| 337 | 331 | |
| 338 | 332 | QScriptEngine::setProcessEventsInterval(MSECS_PER_SECOND); |
| 339 | − | |
| 340 | − _contextAgent = new ScriptContextQtAgent(this, agent()); | |
| 341 | − setAgent(_contextAgent); | |
| 342 | −} | |
| 343 | − | |
| 344 | −ScriptEngineQtScript::~ScriptEngineQtScript() { | |
| 345 | − delete _contextAgent; | |
| 346 | 333 | } |
| 347 | 334 | |
| 348 | 335 | void ScriptEngineQtScript::registerEnum(const QString& enumName, QMetaEnum newEnum) { |
| @@ -912,20 +899,20 @@ ScriptValue ScriptEngineQtScript::create(int type, const void* ptr) { · 563 unmodified lines | ||
| 912 | 899 | return ScriptValue(new ScriptValueQtWrapper(this, std::move(scriptValue))); |
| 913 | 900 | } |
| 914 | 901 | |
| 915 | −QVariant ScriptEngineQtScript::convert(const ScriptValue& value, int type) { | |
| 902 | +QVariant ScriptEngineQtScript::convert(const ScriptValue& value, int typeId) { | |
| 916 | 903 | ScriptValueQtWrapper* unwrapped = ScriptValueQtWrapper::unwrap(value); |
| 917 | 904 | if (unwrapped == nullptr) { |
| 918 | 905 | return QVariant(); |
| 919 | 906 | } |
| 920 | 907 | |
| 921 | 908 | QVariant var; |
| 922 | − if (!castValueToVariant(unwrapped->toQtValue(), var, type)) { | |
| 909 | + if (!castValueToVariant(unwrapped->toQtValue(), var, typeId)) { | |
| 923 | 910 | return QVariant(); |
| 924 | 911 | } |
| 925 | 912 | |
| 926 | 913 | int destType = var.userType(); |
| 927 | − if (destType != type) { | |
| 928 | − var.convert(type); // if conversion fails then var is set to QVariant() | |
| 914 | + if (destType != typeId) { | |
| 915 | + var.convert(typeId); // if conversion fails then var is set to QVariant() | |
| 929 | 916 | } |
| 930 | 917 | |
| 931 | 918 | return var; |