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
61 ScriptEngineQtScript::ObjectWrapperMap::const_iterator lookup = engine->_qobjectWrapperMap.find(object);61 ScriptEngineQtScript::ObjectWrapperMap::const_iterator lookup = engine->_qobjectWrapperMap.find(object);
62 if (lookup != engine->_qobjectWrapperMap.end()) {62 if (lookup != engine->_qobjectWrapperMap.end()) {
63 QSharedPointer<ScriptObjectQtProxy> proxy = lookup.value().lock();63 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)));;
65 }65 }
66 }66 }
67 67
@@ -88,7 +88,7 @@ QScriptValue ScriptObjectQtProxy::newQObject(ScriptEngineQtScript* engine, QObje · 20 unmodified lines
88 ScriptEngineQtScript::ObjectWrapperMap::const_iterator lookup = engine->_qobjectWrapperMap.find(object);88 ScriptEngineQtScript::ObjectWrapperMap::const_iterator lookup = engine->_qobjectWrapperMap.find(object);
89 if (lookup != engine->_qobjectWrapperMap.end()) {89 if (lookup != engine->_qobjectWrapperMap.end()) {
90 QSharedPointer<ScriptObjectQtProxy> proxy = lookup.value().lock();90 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)));;
92 }92 }
93 93
94 // register the wrapper with the engine and make sure it cleans itself up94 // 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
104 });104 });
105 }105 }
106 106
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)));
108}108}
109 109
110ScriptObjectQtProxy* ScriptObjectQtProxy::unwrapProxy(const QScriptValue& val) {110ScriptObjectQtProxy* ScriptObjectQtProxy::unwrapProxy(const QScriptValue& val) {
@@ -385,7 +385,7 @@ QScriptValue ScriptVariantQtProxy::newVariant(ScriptEngineQtScript* engine, cons · 274 unmodified lines
385 return qengine->newVariant(variant);385 return qengine->newVariant(variant);
386 }386 }
387 auto proxy = QSharedPointer<ScriptVariantQtProxy>::create(engine, variant, proto, protoProxy);387 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)));
389}389}
390 390
391ScriptVariantQtProxy* ScriptVariantQtProxy::unwrapProxy(const QScriptValue& val) {391ScriptVariantQtProxy* 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