aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcontextwrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-06-10 13:32:20 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-18 14:41:13 +0000
commit1d76a5d3eab1a071fa35b2668bb09c4adfc41e01 (patch)
tree2a766457bdbb61975b8d98f213b59648bacd69c6 /src/qml/qml/qqmlcontextwrapper.cpp
parent329f9ad18e7dd55b72f6611f321c18538f753ea8 (diff)
Simplify property capturing code
No need to inherit from a base class defined in QQmlEnginePrivate. The capture handling can be a simple value based class without virtual methods that is allocated on the stack. Change-Id: Ib0ddf4afcaf154b3f953d8c9322f5bec196d7abf Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmlcontextwrapper.cpp')
-rw-r--r--src/qml/qml/qqmlcontextwrapper.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp
index 6fbfc844c8..15bf790d4f 100644
--- a/src/qml/qml/qqmlcontextwrapper.cpp
+++ b/src/qml/qml/qqmlcontextwrapper.cpp
@@ -45,6 +45,7 @@
#include <private/qv4compileddata_p.h>
#include <private/qqmltypewrapper_p.h>
#include <private/qqmllistwrapper_p.h>
+#include <private/qqmljavascriptexpression_p.h>
#include <private/qjsvalue_p.h>
QT_BEGIN_NAMESPACE
@@ -209,7 +210,8 @@ ReturnedValue QmlContextWrapper::get(const Managed *m, String *name, bool *hasPr
if (propertyIdx < context->idValueCount) {
- ep->captureProperty(&context->idValues[propertyIdx].bindings);
+ if (ep->propertyCapture)
+ ep->propertyCapture->captureProperty(&context->idValues[propertyIdx].bindings);
if (hasProperty)
*hasProperty = true;
return QV4::QObjectWrapper::wrap(v4, context->idValues[propertyIdx]);
@@ -217,8 +219,8 @@ ReturnedValue QmlContextWrapper::get(const Managed *m, String *name, bool *hasPr
QQmlContextPrivate *cp = context->asQQmlContextPrivate();
- ep->captureProperty(context->asQQmlContext(), -1,
- propertyIdx + cp->notifyIndex);
+ if (ep->propertyCapture)
+ ep->propertyCapture->captureProperty(context->asQQmlContext(), -1, propertyIdx + cp->notifyIndex);
const QVariant &value = cp->propertyValues.at(propertyIdx);
if (hasProperty)
@@ -357,7 +359,7 @@ void QmlContextWrapper::registerQmlDependencies(ExecutionEngine *engine, const C
QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0;
if (!ep)
return;
- QQmlEnginePrivate::PropertyCapture *capture = ep->propertyCapture;
+ QQmlPropertyCapture *capture = ep->propertyCapture;
if (!capture)
return;
@@ -451,8 +453,8 @@ ReturnedValue QQmlIdObjectsArray::getIndexed(const Managed *m, uint index, bool
*hasProperty = true;
QQmlEnginePrivate *ep = scope.engine->qmlEngine() ? QQmlEnginePrivate::get(scope.engine->qmlEngine()) : 0;
- if (ep)
- ep->captureProperty(&context->idValues[index].bindings);
+ if (ep && ep->propertyCapture)
+ ep->propertyCapture->captureProperty(&context->idValues[index].bindings);
return QObjectWrapper::wrap(This->engine(), context->idValues[index].data());
}