History

minor tweaks in response to code review (very belated) and reported issues - explicitly registering some enums with Qt at runtime (needed if they're function return values) - replaced references to engine() with local variables if they already existed

Heather Anderson committed 4 years ago

Commit 0bce0661 parent 55b5a2c5 files · +10 −5Browse files

Showing the changes to libraries/script-engine/src/qtscript/ScriptObjectQtProxy.cpp (1 of 5 files). Show all

Unified · Split

libraries/script-engine/src/qtscript/ScriptObjectQtProxy.cpp+4−4
@@ -61,7 +61,7 @@ QScriptValue ScriptObjectQtProxy::newQObject(ScriptEngineQtScript* engine, QObje · 60 unmodified lines
6161 ScriptEngineQtScript::ObjectWrapperMap::const_iterator lookup = engine->_qobjectWrapperMap.find(object);
6262 if (lookup != engine->_qobjectWrapperMap.end()) {
6363 QSharedPointer<ScriptObjectQtProxy> proxy = lookup.value().lock();
64− if (proxy) return static_cast<QScriptEngine*>(engine)->newObject(proxy.get(), qengine->newVariant(QVariant::fromValue(proxy)));;
64+ if (proxy) return qengine->newObject(proxy.get(), qengine->newVariant(QVariant::fromValue(proxy)));;
6565 }
6666 }
6767
@@ -88,7 +88,7 @@ QScriptValue ScriptObjectQtProxy::newQObject(ScriptEngineQtScript* engine, QObje · 20 unmodified lines
8888 ScriptEngineQtScript::ObjectWrapperMap::const_iterator lookup = engine->_qobjectWrapperMap.find(object);
8989 if (lookup != engine->_qobjectWrapperMap.end()) {
9090 QSharedPointer<ScriptObjectQtProxy> proxy = lookup.value().lock();
91− if (proxy) return static_cast<QScriptEngine*>(engine)->newObject(proxy.get(), qengine->newVariant(QVariant::fromValue(proxy)));;
91+ if (proxy) return qengine->newObject(proxy.get(), qengine->newVariant(QVariant::fromValue(proxy)));;
9292 }
9393
9494 // register the wrapper with the engine and make sure it cleans itself up
@@ -104,7 +104,7 @@ QScriptValue ScriptObjectQtProxy::newQObject(ScriptEngineQtScript* engine, QObje · 9 unmodified lines
104104 });
105105 }
106106
107− return static_cast<QScriptEngine*>(engine)->newObject(proxy.get(), qengine->newVariant(QVariant::fromValue(proxy)));
107+ return qengine->newObject(proxy.get(), qengine->newVariant(QVariant::fromValue(proxy)));
108108 }
109109
110110 ScriptObjectQtProxy* ScriptObjectQtProxy::unwrapProxy(const QScriptValue& val) {
@@ -385,7 +385,7 @@ QScriptValue ScriptVariantQtProxy::newVariant(ScriptEngineQtScript* engine, cons · 274 unmodified lines
385385 return qengine->newVariant(variant);
386386 }
387387 auto proxy = QSharedPointer<ScriptVariantQtProxy>::create(engine, variant, proto, protoProxy);
388− return static_cast<QScriptEngine*>(engine)->newObject(proxy.get(), qengine->newVariant(QVariant::fromValue(proxy)));
388+ return qengine->newObject(proxy.get(), qengine->newVariant(QVariant::fromValue(proxy)));
389389 }
390390
391391 ScriptVariantQtProxy* ScriptVariantQtProxy::unwrapProxy(const QScriptValue& val) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t