diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-12 11:13:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:13:47 +0200 |
commit | 16f92ad85cf665d863ded5eeaaa7fc3f90820b3f (patch) | |
tree | 74b3477b9d6c023730835f1c478ceb6eaec68a2b /src/qml/types | |
parent | 7d4e61dd824706984030c58684fa844ff9cde251 (diff) |
Convert builtin methods to return a ReturnedValue
Change-Id: I6b75adbf53a5be0deab023d2eed98ce2a7915551
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 32 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel_p_p.h | 6 | ||||
-rw-r--r-- | src/qml/types/qquickworkerscript.cpp | 10 |
3 files changed, 24 insertions, 24 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 3e7b23161c..163407c809 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -1690,18 +1690,18 @@ int QQmlDelegateModelItemMetaType::parseGroups(const QV4::Value &groups) const return groupFlags; } -QV4::Value QQmlDelegateModelItem::get_model(QV4::SimpleCallContext *ctx) +QV4::ReturnedValue QQmlDelegateModelItem::get_model(QV4::SimpleCallContext *ctx) { QQmlDelegateModelItemObject *o = ctx->thisObject.as<QQmlDelegateModelItemObject>(); if (!o) ctx->throwTypeError(QStringLiteral("Not a valid VisualData object")); if (!o->item->metaType->model) - return QV4::Value::undefinedValue(); + return QV4::Encode::undefined(); - return o->item->get(); + return o->item->get().asReturnedValue(); } -QV4::Value QQmlDelegateModelItem::get_groups(QV4::SimpleCallContext *ctx) +QV4::ReturnedValue QQmlDelegateModelItem::get_groups(QV4::SimpleCallContext *ctx) { QQmlDelegateModelItemObject *o = ctx->thisObject.as<QQmlDelegateModelItemObject>(); if (!o) @@ -1713,10 +1713,10 @@ QV4::Value QQmlDelegateModelItem::get_groups(QV4::SimpleCallContext *ctx) groups.append(o->item->metaType->groupNames.at(i - 1)); } - return ctx->engine->v8Engine->fromVariant(groups); + return ctx->engine->v8Engine->fromVariant(groups).asReturnedValue(); } -QV4::Value QQmlDelegateModelItem::set_groups(QV4::SimpleCallContext *ctx) +QV4::ReturnedValue QQmlDelegateModelItem::set_groups(QV4::SimpleCallContext *ctx) { QQmlDelegateModelItemObject *o = ctx->thisObject.as<QQmlDelegateModelItemObject>(); if (!o) @@ -1725,14 +1725,14 @@ QV4::Value QQmlDelegateModelItem::set_groups(QV4::SimpleCallContext *ctx) ctx->throwTypeError(); if (!o->item->metaType->model) - return QV4::Value::undefinedValue(); + return QV4::Encode::undefined(); QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(o->item->metaType->model); const int groupFlags = model->m_cacheMetaType->parseGroups(ctx->arguments[0]); const int cacheIndex = model->m_cache.indexOf(o->item); Compositor::iterator it = model->m_compositor.find(Compositor::Cache, cacheIndex); model->setGroups(it, 1, Compositor::Cache, groupFlags); - return QV4::Value::undefinedValue(); + return QV4::Encode::undefined(); } QV4::Value QQmlDelegateModelItem::get_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &) @@ -3106,25 +3106,25 @@ struct QQmlDelegateModelGroupChange : QV4::Object vtbl = &static_vtbl; } - static QV4::Value method_get_index(QV4::SimpleCallContext *ctx) { + static QV4::ReturnedValue method_get_index(QV4::SimpleCallContext *ctx) { QQmlDelegateModelGroupChange *that = ctx->thisObject.as<QQmlDelegateModelGroupChange>(); if (!that) ctx->throwTypeError(); - return QV4::Value::fromInt32(that->change.index); + return QV4::Encode(that->change.index); } - static QV4::Value method_get_count(QV4::SimpleCallContext *ctx) { + static QV4::ReturnedValue method_get_count(QV4::SimpleCallContext *ctx) { QQmlDelegateModelGroupChange *that = ctx->thisObject.as<QQmlDelegateModelGroupChange>(); if (!that) ctx->throwTypeError(); - return QV4::Value::fromInt32(that->change.count); + return QV4::Encode(that->change.count); } - static QV4::Value method_get_moveId(QV4::SimpleCallContext *ctx) { + static QV4::ReturnedValue method_get_moveId(QV4::SimpleCallContext *ctx) { QQmlDelegateModelGroupChange *that = ctx->thisObject.as<QQmlDelegateModelGroupChange>(); if (!that) ctx->throwTypeError(); if (that->change.moveId < 0) - return QV4::Value::undefinedValue(); - return QV4::Value::fromInt32(that->change.moveId); + return QV4::Encode::undefined(); + return QV4::Encode(that->change.moveId); } QQmlChangeSet::Change change; @@ -3180,7 +3180,7 @@ public: if (name == m->engine()->id_length) { if (hasProperty) *hasProperty = true; - return QV4::Value::fromInt32(array->count()).asReturnedValue(); + return QV4::Encode(array->count()); } return Object::get(m, name, hasProperty); diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index 10c5a0f3c4..9b1b64b8db 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -133,9 +133,9 @@ public: virtual void setValue(const QString &role, const QVariant &value) { Q_UNUSED(role); Q_UNUSED(value); } virtual bool resolveIndex(const QQmlAdaptorModel &, int) { return false; } - static QV4::Value get_model(QV4::SimpleCallContext *ctx); - static QV4::Value get_groups(QV4::SimpleCallContext *ctx); - static QV4::Value set_groups(QV4::SimpleCallContext *ctx); + static QV4::ReturnedValue get_model(QV4::SimpleCallContext *ctx); + static QV4::ReturnedValue get_groups(QV4::SimpleCallContext *ctx); + static QV4::ReturnedValue set_groups(QV4::SimpleCallContext *ctx); static QV4::Value get_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &); static QV4::Value set_member(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &arg); static QV4::Value get_index(QQmlDelegateModelItem *thisItem, uint flag, const QV4::Value &arg); diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 6a7374c09e..07acf13314 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -181,7 +181,7 @@ public: int m_nextId; - static QV4::Value sendMessage(QV4::SimpleCallContext *ctx); + static QV4::ReturnedValue method_sendMessage(QV4::SimpleCallContext *ctx); signals: void stopThread(); @@ -234,7 +234,7 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init() QV4::FunctionObject *createsendconstructor = createsendscript.run().asFunctionObject(); QV4::Value function = QV4::Value::fromObject(m_v4Engine->newBuiltinFunction(m_v4Engine->rootContext, m_v4Engine->newString(QStringLiteral("sendMessage")), - QQuickWorkerScriptEnginePrivate::sendMessage)); + QQuickWorkerScriptEnginePrivate::method_sendMessage)); QV4::ScopedCallData callData(scope, 1); callData->args[0] = function; callData->thisObject = global(); @@ -278,7 +278,7 @@ QQuickWorkerScriptEnginePrivate::QQuickWorkerScriptEnginePrivate(QQmlEngine *eng { } -QV4::Value QQuickWorkerScriptEnginePrivate::sendMessage(QV4::SimpleCallContext *ctx) +QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::method_sendMessage(QV4::SimpleCallContext *ctx) { WorkerEngine *engine = (WorkerEngine*)ctx->engine->v8Engine; @@ -289,12 +289,12 @@ QV4::Value QQuickWorkerScriptEnginePrivate::sendMessage(QV4::SimpleCallContext * QMutexLocker locker(&engine->p->m_lock); WorkerScript *script = engine->p->workers.value(id); if (!script) - return QV4::Value::undefinedValue(); + return QV4::Encode::undefined(); if (script->owner) QCoreApplication::postEvent(script->owner, new WorkerDataEvent(0, data)); - return QV4::Value::undefinedValue(); + return QV4::Encode::undefined(); } // Requires handle scope and context scope |