aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmltypewrapper.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-06-06 15:59:41 +0200
committerLars Knoll <lars.knoll@digia.com>2013-06-07 18:33:05 +0200
commit4591504267d4c0c0804592c812ed964ee783eceb (patch)
treeeb3194655d35672e98048d469b3a55e29ec27028 /src/qml/qml/qqmltypewrapper.cpp
parentd05425fb074370ffd3a699a160b468faa2779586 (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/qqmltypewrapper.cpp')
-rw-r--r--src/qml/qml/qqmltypewrapper.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp
index e98117e440..b3b1dedf07 100644
--- a/src/qml/qml/qqmltypewrapper.cpp
+++ b/src/qml/qml/qqmltypewrapper.cpp
@@ -158,10 +158,7 @@ Value QmlTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool
}
// check for property.
- if (QV4::QObjectWrapper *o = QV4::QObjectWrapper::wrap(ctx->engine, qobjectSingleton).as<QV4::QObjectWrapper>())
- return o->getQmlProperty(ctx, context, name, QV4::QObjectWrapper::IgnoreRevision);
- else
- return QV4::Value::undefinedValue();
+ return QV4::QObjectWrapper::getQmlProperty(ctx, context, qobjectSingleton, name, QV4::QObjectWrapper::IgnoreRevision);
} else if (!siinfo->scriptApi(e).isUndefined()) {
QV4::ExecutionEngine *engine = QV8Engine::getV4(v8engine);
// NOTE: if used in a binding, changes will not trigger re-evaluation since non-NOTIFYable.
@@ -184,11 +181,8 @@ Value QmlTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name, bool
} else if (w->object) {
QObject *ao = qmlAttachedPropertiesObjectById(type->attachedPropertiesId(), object);
- if (ao) {
- QV4::QObjectWrapper *wrapper = QV4::QObjectWrapper::wrap(ctx->engine, ao).as<QV4::QObjectWrapper>();
- if (wrapper)
- return wrapper->getQmlProperty(ctx, context, name, QV4::QObjectWrapper::IgnoreRevision);
- }
+ if (ao)
+ return QV4::QObjectWrapper::getQmlProperty(ctx, context, ao, name, QV4::QObjectWrapper::IgnoreRevision);
// Fall through to base implementation
}