diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-06-15 16:41:24 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-18 18:24:34 +0000 |
commit | 5f162e17ed84a7af9c7b17a2538ed8b870685b8f (patch) | |
tree | 2394559a1ac3ff00780534a475b96c3e5b3e4d77 /src/qml/jsruntime/qv4runtime.cpp | |
parent | bc045ae542603b941f61b7f76a7a09a5c8877619 (diff) |
Cleanup retrieval of scope and context objects
Change-Id: I9c6174181f950bc4f829727dc6acdfe82fa4e894
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index 5edea83968..3006ec9fe5 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1340,7 +1340,7 @@ ReturnedValue Runtime::getQmlIdArray(NoThrowEngine *engine) ReturnedValue Runtime::getQmlContextObject(NoThrowEngine *engine) { - QQmlContextData *context = QmlContextWrapper::callingContext(engine); + QQmlContextData *context = engine->callingQmlContext(); if (!context) return Encode::undefined(); return QObjectWrapper::wrap(engine, context->contextObject); @@ -1348,9 +1348,7 @@ ReturnedValue Runtime::getQmlContextObject(NoThrowEngine *engine) ReturnedValue Runtime::getQmlScopeObject(NoThrowEngine *engine) { - Scope scope(engine); - QV4::Scoped<QmlContextWrapper> c(scope, engine->qmlContextObject()); - return QObjectWrapper::wrap(engine, c->getScopeObject()); + return QObjectWrapper::wrap(engine, engine->qmlScopeObject()); } ReturnedValue Runtime::getQmlQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired) @@ -1366,14 +1364,12 @@ ReturnedValue Runtime::getQmlQObjectProperty(ExecutionEngine *engine, const Valu QV4::ReturnedValue Runtime::getQmlAttachedProperty(ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex) { - Scope scope(engine); - QV4::Scoped<QmlContextWrapper> c(scope, engine->qmlContextObject()); - QObject *scopeObject = c->getScopeObject(); + QObject *scopeObject = engine->qmlScopeObject(); QObject *attachedObject = qmlAttachedPropertiesObjectById(attachedPropertiesId, scopeObject); QJSEngine *jsEngine = engine->jsEngine(); QQmlData::ensurePropertyCache(jsEngine, attachedObject); - return QV4::QObjectWrapper::getProperty(scope.engine, attachedObject, propertyIndex, /*captureRequired*/true); + return QV4::QObjectWrapper::getProperty(engine, attachedObject, propertyIndex, /*captureRequired*/true); } ReturnedValue Runtime::getQmlSingletonQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired) @@ -1400,7 +1396,7 @@ void Runtime::setQmlQObjectProperty(ExecutionEngine *engine, const Value &object ReturnedValue Runtime::getQmlImportedScripts(NoThrowEngine *engine) { - QQmlContextData *context = QmlContextWrapper::callingContext(engine); + QQmlContextData *context = engine->callingQmlContext(); if (!context) return Encode::undefined(); return context->importedScripts.value(); |