diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-06 15:59:41 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@digia.com> | 2013-06-07 18:33:05 +0200 |
commit | 4591504267d4c0c0804592c812ed964ee783eceb (patch) | |
tree | eb3194655d35672e98048d469b3a55e29ec27028 /src/qml/qml/qqmlcontextwrapper.cpp | |
parent | d05425fb074370ffd3a699a160b468faa2779586 (diff) |
Simplify QObjectWrapper calls from within other type wrappers
... with the help of a getQmlProperty static function.
Change-Id: Ia823ba9ac995cb1a0591081bf18418f48d60e04d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcontextwrapper.cpp')
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index dd7d28ce66..ddeaead6a8 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -228,14 +228,12 @@ Value QmlContextWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bo // Search scope object if (scopeObject) { - if (QV4::QObjectWrapper *o = QV4::QObjectWrapper::wrap(ctx->engine, scopeObject).as<QV4::QObjectWrapper>()) { - bool hasProp = false; - QV4::Value result = o->getQmlProperty(ctx, context, name, QV4::QObjectWrapper::CheckRevision, &hasProp); - if (hasProp) { - if (hasProperty) - *hasProperty = true; - return result; - } + bool hasProp = false; + QV4::Value result = QV4::QObjectWrapper::getQmlProperty(ctx, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, &hasProp); + if (hasProp) { + if (hasProperty) + *hasProperty = true; + return result; } } scopeObject = 0; @@ -243,14 +241,12 @@ Value QmlContextWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bo // Search context object if (context->contextObject) { - if (QV4::QObjectWrapper *o = QV4::QObjectWrapper::wrap(ctx->engine, context->contextObject).as<QV4::QObjectWrapper>()) { - bool hasProp = false; - QV4::Value result = o->getQmlProperty(ctx, context, name, QV4::QObjectWrapper::CheckRevision, &hasProp); - if (hasProp) { - if (hasProperty) - *hasProperty = true; - return result; - } + bool hasProp = false; + QV4::Value result = QV4::QObjectWrapper::getQmlProperty(ctx, context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, &hasProp); + if (hasProp) { + if (hasProperty) + *hasProperty = true; + return result; } } |