diff options
29 files changed, 176 insertions, 176 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index d1eb3377b8..f5627984d8 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -607,10 +607,10 @@ public: ~QQuickLocalStorage() { } - Q_INVOKABLE void openDatabaseSync(QQmlV8Function* args); + Q_INVOKABLE void openDatabaseSync(QQmlV4Function* args); }; -void QQuickLocalStorage::openDatabaseSync(QQmlV8Function *args) +void QQuickLocalStorage::openDatabaseSync(QQmlV4Function *args) { #ifndef QT_NO_SETTINGS QV8Engine *engine = args->engine(); @@ -621,10 +621,10 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV8Function *args) QSqlDatabase database; - QString dbname = (*args)[0]->v4Value().toQString(); - QString dbversion = (*args)[1]->v4Value().toQString(); - QString dbdescription = (*args)[2]->v4Value().toQString(); - int dbestimatedsize = (*args)[3]->Int32Value(); + QString dbname = (*args)[0].toQString(); + QString dbversion = (*args)[1].toQString(); + QString dbdescription = (*args)[2].toQString(); + int dbestimatedsize = (*args)[3].toInt32(); v8::Handle<v8::Value> dbcreationCallback = (*args)[4]; QCryptographicHash md5(QCryptographicHash::Md5); @@ -685,7 +685,7 @@ void QQuickLocalStorage::openDatabaseSync(QQmlV8Function *args) } } - args->returnValue(instance); + args->setReturnValue(instance->v4Value()); #endif // QT_NO_SETTINGS } diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 52777b023f..471d5fca8b 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1177,7 +1177,7 @@ static void QQmlComponent_setQmlParent(QObject *me, QObject *parent) /*! \internal */ -void QQmlComponent::createObject(QQmlV8Function *args) +void QQmlComponent::createObject(QQmlV4Function *args) { Q_D(QQmlComponent); Q_ASSERT(d->engine); @@ -1186,14 +1186,14 @@ void QQmlComponent::createObject(QQmlV8Function *args) QObject *parent = 0; v8::Handle<v8::Object> valuemap; - if (args->Length() >= 1) - parent = args->engine()->toQObject((*args)[0]->v4Value()); + if (args->length() >= 1) + parent = args->engine()->toQObject((*args)[0]); - if (args->Length() >= 2) { + if (args->length() >= 2) { v8::Handle<v8::Value> v = (*args)[1]; if (!v->IsObject() || v->IsArray()) { qmlInfo(this) << tr("createObject: value is not an object"); - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); return; } valuemap = v8::Handle<v8::Object>::Cast(v); @@ -1208,7 +1208,7 @@ void QQmlComponent::createObject(QQmlV8Function *args) QObject *rv = beginCreate(ctxt); if (!rv) { - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); return; } @@ -1220,7 +1220,7 @@ void QQmlComponent::createObject(QQmlV8Function *args) if (!valuemap.IsEmpty()) { QQmlComponentExtension *e = componentExtension(v8engine); - QV4::Value f = v8engine->evaluateScript(QString::fromLatin1(INITIALPROPERTIES_SOURCE), args->qmlGlobal()->v4Value().asObject()); + QV4::Value f = v8engine->evaluateScript(QString::fromLatin1(INITIALPROPERTIES_SOURCE), args->qmlGlobal().asObject()); QV4::Value args[] = { object->v4Value(), valuemap->v4Value() }; f.asFunctionObject()->call(v4engine->current, QV4::Value::fromObject(v4engine->globalObject), args, 2); } @@ -1232,9 +1232,9 @@ void QQmlComponent::createObject(QQmlV8Function *args) QQmlData::get(rv)->indestructible = false; if (!rv) - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); else - args->returnValue(object); + args->setReturnValue(object->v4Value()); } /*! @@ -1296,7 +1296,7 @@ void QQmlComponent::createObject(QQmlV8Function *args) /*! \internal */ -void QQmlComponent::incubateObject(QQmlV8Function *args) +void QQmlComponent::incubateObject(QQmlV4Function *args) { Q_D(QQmlComponent); Q_ASSERT(d->engine); @@ -1307,23 +1307,23 @@ void QQmlComponent::incubateObject(QQmlV8Function *args) v8::Handle<v8::Object> valuemap; QQmlIncubator::IncubationMode mode = QQmlIncubator::Asynchronous; - if (args->Length() >= 1) - parent = args->engine()->toQObject((*args)[0]->v4Value()); + if (args->length() >= 1) + parent = args->engine()->toQObject((*args)[0]); - if (args->Length() >= 2) { + if (args->length() >= 2) { v8::Handle<v8::Value> v = (*args)[1]; if (v->IsNull()) { } else if (!v->IsObject() || v->IsArray()) { qmlInfo(this) << tr("createObject: value is not an object"); - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); return; } else { valuemap = v8::Handle<v8::Object>::Cast(v); } } - if (args->Length() >= 3) { - quint32 v = (*args)[2]->Uint32Value(); + if (args->length() >= 3) { + quint32 v = (*args)[2].toUInt32(); if (v == 0) mode = QQmlIncubator::Asynchronous; else if (v == 1) @@ -1338,7 +1338,7 @@ void QQmlComponent::incubateObject(QQmlV8Function *args) if (!valuemap.IsEmpty()) { r->valuemap = valuemap->v4Value(); - r->qmlGlobal = args->qmlGlobal()->v4Value(); + r->qmlGlobal = args->qmlGlobal(); } r->parent = parent; r->me = o->v4Value(); @@ -1347,9 +1347,9 @@ void QQmlComponent::incubateObject(QQmlV8Function *args) if (r->status() == QQmlIncubator::Null) { r->dispose(); - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); } else { - args->returnValue(o); + args->setReturnValue(o->v4Value()); } } diff --git a/src/qml/qml/qqmlcomponent.h b/src/qml/qml/qqmlcomponent.h index aefad475b4..9877f59fb6 100644 --- a/src/qml/qml/qqmlcomponent.h +++ b/src/qml/qml/qqmlcomponent.h @@ -56,7 +56,7 @@ class QByteArray; class QQmlEngine; class QQmlComponent; class QQmlIncubator; -class QQmlV8Function; +class QQmlV4Function; class QQmlCompiledData; class QQmlComponentPrivate; class QQmlComponentAttached; @@ -120,8 +120,8 @@ Q_SIGNALS: protected: QQmlComponent(QQmlComponentPrivate &dd, QObject* parent); - Q_INVOKABLE void createObject(QQmlV8Function *); - Q_INVOKABLE void incubateObject(QQmlV8Function *); + Q_INVOKABLE void createObject(QQmlV4Function *); + Q_INVOKABLE void incubateObject(QQmlV4Function *); private: QQmlComponent(QQmlEngine *, QQmlCompiledData *, int, QObject *parent); diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 9781375657..7473a71937 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -80,6 +80,7 @@ #include "qv8sequencewrapper_p.h" #include "qv4jsonwrapper_p.h" #include <private/qv4value_p.h> +#include <private/qv4object_p.h> QT_BEGIN_NAMESPACE @@ -174,32 +175,32 @@ inline T *v8_resource_check(v8::Handle<v8::Object> object) { // valid during the call. If the return value isn't set within myMethod(), the will return // undefined. class QV8Engine; -class QQmlV8Function +class QQmlV4Function { public: - int Length() const { return _ac; } - v8::Handle<v8::Value> operator[](int idx) { return (*_a)->Get(idx); } - QQmlContextData *context() { return _c; } - v8::Handle<v8::Object> qmlGlobal() { return *_g; } - void returnValue(v8::Handle<v8::Value> rv) { *_r = rv; } - QV8Engine *engine() const { return _e; } + int length() const { return argc; } + QV4::Value operator[](int idx) { return args.asObject()->getIndexed(idx); } + QQmlContextData *context() { return ctx; } + QV4::Value qmlGlobal() { return global; } + void setReturnValue(const QV4::Value &rv) { *retVal = rv; } + QV8Engine *engine() const { return e; } private: friend class QV8QObjectWrapper; - QQmlV8Function(); - QQmlV8Function(const QQmlV8Function &); - QQmlV8Function &operator=(const QQmlV8Function &); + QQmlV4Function(); + QQmlV4Function(const QQmlV4Function &); + QQmlV4Function &operator=(const QQmlV4Function &); - QQmlV8Function(int length, v8::Handle<v8::Object> &args, - v8::Handle<v8::Value> &rv, v8::Handle<v8::Object> &global, + QQmlV4Function(int length, const QV4::Value &args, + QV4::Value *rv, const QV4::Value &global, QQmlContextData *c, QV8Engine *e) - : _ac(length), _a(&args), _r(&rv), _g(&global), _c(c), _e(e) {} - - int _ac; - v8::Handle<v8::Object> *_a; - v8::Handle<v8::Value> *_r; - v8::Handle<v8::Object> *_g; - QQmlContextData *_c; - QV8Engine *_e; + : argc(length), args(args), retVal(rv), global(global), ctx(c), e(e) {} + + int argc; + QV4::Value args; + QV4::Value *retVal; + QV4::Value global; + QQmlContextData *ctx; + QV8Engine *e; }; class Q_QML_PRIVATE_EXPORT QQmlV4Handle diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp index d998c25236..a0d866b6ac 100644 --- a/src/qml/qml/v8/qv8qobjectwrapper.cpp +++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp @@ -2018,19 +2018,18 @@ QV4::Value QV8QObjectWrapper::Invoke(const v8::Arguments &args) } if (method.isV8Function()) { - v8::Handle<v8::Value> rv; - v8::Handle<v8::Object> qmlglobal = args[2]->ToObject(); + QV4::Value rv = QV4::Value::undefinedValue(); + v8::Handle<v8::Value> qmlglobal = args[2]; - QQmlV8Function func(argCount, arguments, rv, qmlglobal, + QQmlV4Function func(argCount, arguments->v4Value(), &rv, qmlglobal->v4Value(), resource->engine->contextWrapper()->context(qmlglobal), resource->engine); - QQmlV8Function *funcptr = &func; + QQmlV4Function *funcptr = &func; void *args[] = { 0, &funcptr }; QMetaObject::metacall(object, QMetaObject::InvokeMetaMethod, method.coreIndex, args); - if (rv.IsEmpty()) return QV4::Value::undefinedValue(); - return rv->v4Value(); + return rv; } CallArgs callArgs(argCount, &arguments); diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 4d0f17489c..6242af8fcd 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -2397,7 +2397,7 @@ bool QQmlDelegateModelGroupPrivate::parseIndex( items that are later replaced by actual data. */ -void QQmlDelegateModelGroup::insert(QQmlV8Function *args) +void QQmlDelegateModelGroup::insert(QQmlV4Function *args) { Q_D(QQmlDelegateModelGroup); QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model); @@ -2405,7 +2405,7 @@ void QQmlDelegateModelGroup::insert(QQmlV8Function *args) int index = model->m_compositor.count(d->group); Compositor::Group group = d->group; - if (args->Length() == 0) + if (args->length() == 0) return; int i = 0; @@ -2415,7 +2415,7 @@ void QQmlDelegateModelGroup::insert(QQmlV8Function *args) qmlInfo(this) << tr("insert: index out of range"); return; } - if (++i == args->Length()) + if (++i == args->length()) return; v = (*args)[i]; } @@ -2425,7 +2425,7 @@ void QQmlDelegateModelGroup::insert(QQmlV8Function *args) : model->m_compositor.end(); int groups = 1 << d->group; - if (++i < args->Length()) + if (++i < args->length()) groups |= model->m_cacheMetaType->parseGroups((*args)[i]); if (v->IsArray()) { @@ -2453,13 +2453,13 @@ void QQmlDelegateModelGroup::insert(QQmlV8Function *args) group remain instantiated when not referenced by any view. */ -void QQmlDelegateModelGroup::create(QQmlV8Function *args) +void QQmlDelegateModelGroup::create(QQmlV4Function *args) { Q_D(QQmlDelegateModelGroup); if (!d->model) return; - if (args->Length() == 0) + if (args->length() == 0) return; QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model); @@ -2472,11 +2472,11 @@ void QQmlDelegateModelGroup::create(QQmlV8Function *args) if (d->parseIndex(v, &index, &group)) ++i; - if (i < args->Length() && index >= 0 && index <= model->m_compositor.count(group)) { + if (i < args->length() && index >= 0 && index <= model->m_compositor.count(group)) { v = (*args)[i]; if (v->IsObject()) { int groups = 1 << d->group; - if (++i < args->Length()) + if (++i < args->length()) groups |= model->m_cacheMetaType->parseGroups((*args)[i]); Compositor::insert_iterator before = index < model->m_compositor.count(group) @@ -2505,7 +2505,7 @@ void QQmlDelegateModelGroup::create(QQmlV8Function *args) model->m_cache.at(it.cacheIndex)->releaseObject(); } - args->returnValue(args->engine()->newQObject(object)); + args->setReturnValue(args->engine()->newQObject(object)); model->emitChanges(); } @@ -2525,7 +2525,7 @@ void QQmlDelegateModelGroup::create(QQmlV8Function *args) that the previously unresolved item has simply moved. */ -void QQmlDelegateModelGroup::resolve(QQmlV8Function *args) +void QQmlDelegateModelGroup::resolve(QQmlV4Function *args) { Q_D(QQmlDelegateModelGroup); if (!d->model) @@ -2533,7 +2533,7 @@ void QQmlDelegateModelGroup::resolve(QQmlV8Function *args) QQmlDelegateModelPrivate *model = QQmlDelegateModelPrivate::get(d->model); - if (args->Length() < 2) + if (args->length() < 2) return; int from = -1; @@ -2625,7 +2625,7 @@ void QQmlDelegateModelGroup::resolve(QQmlV8Function *args) Removes \a count items starting at \a index from the group. */ -void QQmlDelegateModelGroup::remove(QQmlV8Function *args) +void QQmlDelegateModelGroup::remove(QQmlV4Function *args) { Q_D(QQmlDelegateModelGroup); if (!d->model) @@ -2634,7 +2634,7 @@ void QQmlDelegateModelGroup::remove(QQmlV8Function *args) int index = -1; int count = 1; - if (args->Length() == 0) + if (args->length() == 0) return; int i = 0; @@ -2644,7 +2644,7 @@ void QQmlDelegateModelGroup::remove(QQmlV8Function *args) return; } - if (++i < args->Length()) { + if (++i < args->length()) { v = (*args)[i]; if (v->IsInt32()) count = v->Int32Value(); @@ -2664,12 +2664,12 @@ void QQmlDelegateModelGroup::remove(QQmlV8Function *args) } bool QQmlDelegateModelGroupPrivate::parseGroupArgs( - QQmlV8Function *args, Compositor::Group *group, int *index, int *count, int *groups) const + QQmlV4Function *args, Compositor::Group *group, int *index, int *count, int *groups) const { if (!model || !QQmlDelegateModelPrivate::get(model)->m_cacheMetaType) return false; - if (args->Length() < 2) + if (args->length() < 2) return false; int i = 0; @@ -2681,7 +2681,7 @@ bool QQmlDelegateModelGroupPrivate::parseGroupArgs( if (v->IsInt32()) { *count = v->Int32Value(); - if (++i == args->Length()) + if (++i == args->length()) return false; v = (*args)[i]; } @@ -2697,7 +2697,7 @@ bool QQmlDelegateModelGroupPrivate::parseGroupArgs( Adds \a count items starting at \a index to \a groups. */ -void QQmlDelegateModelGroup::addGroups(QQmlV8Function *args) +void QQmlDelegateModelGroup::addGroups(QQmlV4Function *args) { Q_D(QQmlDelegateModelGroup); Compositor::Group group = d->group; @@ -2727,7 +2727,7 @@ void QQmlDelegateModelGroup::addGroups(QQmlV8Function *args) Removes \a count items starting at \a index from \a groups. */ -void QQmlDelegateModelGroup::removeGroups(QQmlV8Function *args) +void QQmlDelegateModelGroup::removeGroups(QQmlV4Function *args) { Q_D(QQmlDelegateModelGroup); Compositor::Group group = d->group; @@ -2757,7 +2757,7 @@ void QQmlDelegateModelGroup::removeGroups(QQmlV8Function *args) Sets the \a groups \a count items starting at \a index belong to. */ -void QQmlDelegateModelGroup::setGroups(QQmlV8Function *args) +void QQmlDelegateModelGroup::setGroups(QQmlV4Function *args) { Q_D(QQmlDelegateModelGroup); Compositor::Group group = d->group; @@ -2793,11 +2793,11 @@ void QQmlDelegateModelGroup::setGroups(QQmlV8Function *args) Moves \a count at \a from in a group \a to a new position. */ -void QQmlDelegateModelGroup::move(QQmlV8Function *args) +void QQmlDelegateModelGroup::move(QQmlV4Function *args) { Q_D(QQmlDelegateModelGroup); - if (args->Length() < 2) + if (args->length() < 2) return; Compositor::Group fromGroup = d->group; @@ -2816,7 +2816,7 @@ void QQmlDelegateModelGroup::move(QQmlV8Function *args) return; } - if (args->Length() > 2) { + if (args->length() > 2) { v8::Handle<v8::Value> v = (*args)[2]; if (v->IsInt32()) count = v->Int32Value(); diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h index d1cdd52bd3..6f2acf0924 100644 --- a/src/qml/types/qqmldelegatemodel_p.h +++ b/src/qml/types/qqmldelegatemodel_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class QQmlChangeSet; class QQmlComponent; class QQuickPackage; -class QQmlV8Function; +class QQmlV4Function; class QQmlDelegateModelGroup; class QQmlDelegateModelAttached; class QQmlDelegateModelPrivate; @@ -168,14 +168,14 @@ public: Q_INVOKABLE QQmlV4Handle get(int index); public Q_SLOTS: - void insert(QQmlV8Function *); - void create(QQmlV8Function *); - void resolve(QQmlV8Function *); - void remove(QQmlV8Function *); - void addGroups(QQmlV8Function *); - void removeGroups(QQmlV8Function *); - void setGroups(QQmlV8Function *); - void move(QQmlV8Function *); + void insert(QQmlV4Function *); + void create(QQmlV4Function *); + void resolve(QQmlV4Function *); + void remove(QQmlV4Function *); + void addGroups(QQmlV4Function *); + void removeGroups(QQmlV4Function *); + void setGroups(QQmlV4Function *); + void move(QQmlV4Function *); Q_SIGNALS: void countChanged(); diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index 16ecdd80be..9311ad0598 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -215,7 +215,7 @@ public: bool parseIndex(const v8::Handle<v8::Value> &value, int *index, Compositor::Group *group) const; bool parseGroupArgs( - QQmlV8Function *args, Compositor::Group *group, int *index, int *count, int *groups) const; + QQmlV4Function *args, Compositor::Group *group, int *index, int *count, int *groups) const; Compositor::Group group; QQmlGuard<QQmlDelegateModel> model; diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 23a41d426b..d44773cb78 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1894,13 +1894,13 @@ void QQmlListModel::clear() \sa clear() */ -void QQmlListModel::remove(QQmlV8Function *args) +void QQmlListModel::remove(QQmlV4Function *args) { - int argLength = args->Length(); + int argLength = args->length(); if (argLength == 1 || argLength == 2) { - int index = (*args)[0]->Int32Value(); - int removeCount = (argLength == 2 ? ((*args)[1]->Int32Value()) : 1); + int index = (*args)[0].toInt32(); + int removeCount = (argLength == 2 ? (*args)[1].toInt32() : 1); if (index < 0 || index+removeCount > count() || removeCount <= 0) { qmlInfo(this) << tr("remove: indices [%1 - %2] out of range [0 - %3]").arg(index).arg(index+removeCount).arg(count()); @@ -1937,9 +1937,9 @@ void QQmlListModel::remove(QQmlV8Function *args) \sa set(), append() */ -void QQmlListModel::insert(QQmlV8Function *args) +void QQmlListModel::insert(QQmlV4Function *args) { - if (args->Length() == 2) { + if (args->length() == 2) { v8::Handle<v8::Value> arg0 = (*args)[0]; int index = arg0->Int32Value(); @@ -2047,9 +2047,9 @@ void QQmlListModel::move(int from, int to, int n) \sa set(), remove() */ -void QQmlListModel::append(QQmlV8Function *args) +void QQmlListModel::append(QQmlV4Function *args) { - if (args->Length() == 1) { + if (args->length() == 1) { v8::Handle<v8::Value> arg = (*args)[0]; if (arg->IsArray()) { diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h index 312abb6673..722cb2b44d 100644 --- a/src/qml/types/qqmllistmodel_p.h +++ b/src/qml/types/qqmllistmodel_p.h @@ -81,9 +81,9 @@ public: int count() const; Q_INVOKABLE void clear(); - Q_INVOKABLE void remove(QQmlV8Function *args); - Q_INVOKABLE void append(QQmlV8Function *args); - Q_INVOKABLE void insert(QQmlV8Function *args); + Q_INVOKABLE void remove(QQmlV4Function *args); + Q_INVOKABLE void append(QQmlV4Function *args); + Q_INVOKABLE void insert(QQmlV4Function *args); Q_INVOKABLE QQmlV4Handle get(int index) const; Q_INVOKABLE void set(int index, const QQmlV4Handle &); Q_INVOKABLE void setProperty(int index, const QString& property, const QVariant& value); diff --git a/src/qml/types/qqmllistmodelworkeragent.cpp b/src/qml/types/qqmllistmodelworkeragent.cpp index 827fe03c61..1dc5fcf953 100644 --- a/src/qml/types/qqmllistmodelworkeragent.cpp +++ b/src/qml/types/qqmllistmodelworkeragent.cpp @@ -132,17 +132,17 @@ void QQmlListModelWorkerAgent::clear() m_copy->clear(); } -void QQmlListModelWorkerAgent::remove(QQmlV8Function *args) +void QQmlListModelWorkerAgent::remove(QQmlV4Function *args) { m_copy->remove(args); } -void QQmlListModelWorkerAgent::append(QQmlV8Function *args) +void QQmlListModelWorkerAgent::append(QQmlV4Function *args) { m_copy->append(args); } -void QQmlListModelWorkerAgent::insert(QQmlV8Function *args) +void QQmlListModelWorkerAgent::insert(QQmlV4Function *args) { m_copy->insert(args); } diff --git a/src/qml/types/qqmllistmodelworkeragent_p.h b/src/qml/types/qqmllistmodelworkeragent_p.h index a76f66005b..1299d81c56 100644 --- a/src/qml/types/qqmllistmodelworkeragent_p.h +++ b/src/qml/types/qqmllistmodelworkeragent_p.h @@ -81,9 +81,9 @@ public: int count() const; Q_INVOKABLE void clear(); - Q_INVOKABLE void remove(QQmlV8Function *args); - Q_INVOKABLE void append(QQmlV8Function *args); - Q_INVOKABLE void insert(QQmlV8Function *args); + Q_INVOKABLE void remove(QQmlV4Function *args); + Q_INVOKABLE void append(QQmlV4Function *args); + Q_INVOKABLE void insert(QQmlV4Function *args); Q_INVOKABLE QQmlV4Handle get(int index) const; Q_INVOKABLE void set(int index, const QQmlV4Handle &); Q_INVOKABLE void setProperty(int index, const QString& property, const QVariant& value); diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 6a98621783..b0822968e3 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -652,7 +652,7 @@ void QQuickWorkerScript::setSource(const QUrl &source) of ListModel objects, any modifications by the other thread to an object passed in \c message will not be reflected in the original object. */ -void QQuickWorkerScript::sendMessage(QQmlV8Function *args) +void QQuickWorkerScript::sendMessage(QQmlV4Function *args) { if (!engine()) { qWarning("QQuickWorkerScript: Attempt to send message before WorkerScript establishment"); @@ -660,7 +660,7 @@ void QQuickWorkerScript::sendMessage(QQmlV8Function *args) } v8::Handle<v8::Value> argument = QV4::Value::undefinedValue(); - if (args->Length() != 0) + if (args->length() != 0) argument = (*args)[0]; m_engine->sendMessage(m_scriptId, QV8Worker::serialize(argument, args->engine())); diff --git a/src/qml/types/qquickworkerscript_p.h b/src/qml/types/qquickworkerscript_p.h index 7921b90295..bf23a3f2a2 100644 --- a/src/qml/types/qquickworkerscript_p.h +++ b/src/qml/types/qquickworkerscript_p.h @@ -84,7 +84,7 @@ private: QQuickWorkerScriptEnginePrivate *d; }; -class QQmlV8Function; +class QQmlV4Function; class QQmlV4Handle; class Q_AUTOTEST_EXPORT QQuickWorkerScript : public QObject, public QQmlParserStatus { @@ -100,7 +100,7 @@ public: void setSource(const QUrl &); public slots: - void sendMessage(QQmlV8Function*); + void sendMessage(QQmlV4Function*); signals: void sourceChanged(); diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 507ac4156f..c14da7fa56 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -472,10 +472,10 @@ bool QuickTestResult::fuzzyCompare(const QVariant &actual, const QVariant &expec return false; } -void QuickTestResult::stringify(QQmlV8Function *args) +void QuickTestResult::stringify(QQmlV4Function *args) { - if (args->Length() < 1) - args->returnValue(QV4::Value::nullValue()); + if (args->length() < 1) + args->setReturnValue(QV4::Value::nullValue()); v8::Handle<v8::Value> value = (*args)[0]; @@ -513,7 +513,7 @@ void QuickTestResult::stringify(QQmlV8Function *args) result.append(tmp); } - args->returnValue(args->engine()->toString(result)); + args->setReturnValue(args->engine()->toString(result)); } bool QuickTestResult::compare diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h index 6886d3e09f..4639c1b776 100644 --- a/src/qmltest/quicktestresult_p.h +++ b/src/qmltest/quicktestresult_p.h @@ -112,7 +112,7 @@ public Q_SLOTS: void finishTestDataCleanup(); void finishTestFunction(); - void stringify(QQmlV8Function *args); + void stringify(QQmlV4Function *args); void fail(const QString &message, const QUrl &location, int line); bool verify(bool success, const QString &message, diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 1c71c9b0cc..780517ca29 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -724,19 +724,19 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData Canvas only supports a 2d context. */ -void QQuickCanvasItem::getContext(QQmlV8Function *args) +void QQuickCanvasItem::getContext(QQmlV4Function *args) { Q_D(QQuickCanvasItem); - if (args->Length() < 1 || !(*args)[0]->IsString()) { + if (args->length() < 1 || !(*args)[0].isString()) { qmlInfo(this) << "getContext should be called with a string naming the required context type"; - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); return; } if (!d->available) { qmlInfo(this) << "Unable to use getContext() at this time, please wait for available: true"; - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); return; } @@ -744,19 +744,19 @@ void QQuickCanvasItem::getContext(QQmlV8Function *args) if (d->context != 0) { if (d->context->contextNames().contains(contextId, Qt::CaseInsensitive)) { - args->returnValue(d->context->v8value()); + args->setReturnValue(d->context->v8value()->v4Value()); return; } qmlInfo(this) << "Canvas already initialized with a different context type"; - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); return; } if (createContext(contextId)) - args->returnValue(d->context->v8value()); + args->setReturnValue(d->context->v8value()->v4Value()); else - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); } /*! @@ -766,11 +766,11 @@ void QQuickCanvasItem::getContext(QQmlV8Function *args) scene. */ -void QQuickCanvasItem::requestAnimationFrame(QQmlV8Function *args) +void QQuickCanvasItem::requestAnimationFrame(QQmlV4Function *args) { - if (args->Length() < 1 || !(*args)[0]->IsFunction()) { + if (args->length() < 1 || !(*args)[0].asFunctionObject()) { qmlInfo(this) << "requestAnimationFrame should be called with an animation callback function"; - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); return; } @@ -778,12 +778,12 @@ void QQuickCanvasItem::requestAnimationFrame(QQmlV8Function *args) static int id = 0; - d->animationCallbacks.insert(++id, QV4::PersistentValue(((*args)[0])->v4Value())); + d->animationCallbacks.insert(++id, QV4::PersistentValue((*args)[0])); if (isVisible()) polish(); - args->returnValue(v8::Int32::New(id)); + args->setReturnValue(QV4::Value::fromInt32(id)); } /*! @@ -792,15 +792,15 @@ void QQuickCanvasItem::requestAnimationFrame(QQmlV8Function *args) This function will cancel the animation callback referenced by \a handle. */ -void QQuickCanvasItem::cancelRequestAnimationFrame(QQmlV8Function *args) +void QQuickCanvasItem::cancelRequestAnimationFrame(QQmlV4Function *args) { - if (args->Length() < 1 || !(*args)[0]->IsInt32()) { + if (args->length() < 1 || !(*args)[0].isInteger()) { qmlInfo(this) << "cancelRequestAnimationFrame should be called with an animation callback id"; - args->returnValue(QV4::Value::nullValue()); + args->setReturnValue(QV4::Value::nullValue()); return; } - d_func()->animationCallbacks.remove((*args)[0]->Int32Value()); + d_func()->animationCallbacks.remove((*args)[0].integerValue()); } diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h index 09c3802563..09922f1045 100644 --- a/src/quick/items/context2d/qquickcanvasitem_p.h +++ b/src/quick/items/context2d/qquickcanvasitem_p.h @@ -133,10 +133,10 @@ public: QImage toImage(const QRectF& rect = QRectF()) const; - Q_INVOKABLE void getContext(QQmlV8Function *args); + Q_INVOKABLE void getContext(QQmlV4Function *args); - Q_INVOKABLE void requestAnimationFrame(QQmlV8Function *args); - Q_INVOKABLE void cancelRequestAnimationFrame(QQmlV8Function *args); + Q_INVOKABLE void requestAnimationFrame(QQmlV4Function *args); + Q_INVOKABLE void cancelRequestAnimationFrame(QQmlV4Function *args); Q_INVOKABLE void requestPaint(); Q_INVOKABLE void markDirty(const QRectF& dirtyRect = QRectF()); diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index ccd3082fbf..14bd4b5870 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -502,7 +502,7 @@ void QQuickDragAttachedPrivate::start(Qt::DropActions supportedActions) property for the started sequence. */ -void QQuickDragAttached::start(QQmlV8Function *args) +void QQuickDragAttached::start(QQmlV4Function *args) { Q_D(QQuickDragAttached); if (d->inEvent) { @@ -516,7 +516,7 @@ void QQuickDragAttached::start(QQmlV8Function *args) d->overrideActions = false; Qt::DropActions supportedActions = d->supportedActions; // check arguments for supportedActions, maybe data? - if (args->Length() >= 1) { + if (args->length() >= 1) { v8::Handle<v8::Value> v = (*args)[0]; if (v->IsInt32()) { supportedActions = Qt::DropActions(v->Int32Value()); diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h index c1835d9504..b7fa60b748 100644 --- a/src/quick/items/qquickdrag_p.h +++ b/src/quick/items/qquickdrag_p.h @@ -141,7 +141,7 @@ private: friend class QQuickDragAttachedPrivate; }; -class QQmlV8Function; +class QQmlV4Function; class QQuickDragAttachedPrivate; class QQuickDragAttached : public QObject @@ -184,7 +184,7 @@ public: bool event(QEvent *event); public Q_SLOTS: - void start(QQmlV8Function *); + void start(QQmlV4Function *); void cancel(); Q_SIGNALS: diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index cda308e0b6..3b8f02db8c 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -416,11 +416,11 @@ QStringList QQuickDropEvent::keys() const If an \a action is specified it will overwrite the value of the \l action property. */ -void QQuickDropEvent::accept(QQmlV8Function *args) +void QQuickDropEvent::accept(QQmlV4Function *args) { Qt::DropAction action = event->dropAction(); - if (args->Length() >= 1) { + if (args->length() >= 1) { v8::Handle<v8::Value> v = (*args)[0]; if (v->IsInt32()) action = Qt::DropAction(v->Int32Value()); diff --git a/src/quick/items/qquickdroparea_p.h b/src/quick/items/qquickdroparea_p.h index bfc3f922b5..3bdbe7f72e 100644 --- a/src/quick/items/qquickdroparea_p.h +++ b/src/quick/items/qquickdroparea_p.h @@ -82,7 +82,7 @@ public: bool accepted() const { return event->isAccepted(); } void setAccepted(bool accepted) { event->setAccepted(accepted); } - Q_INVOKABLE void accept(QQmlV8Function *); + Q_INVOKABLE void accept(QQmlV4Function *); private: QQuickDropAreaPrivate *d; diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 43328c3f96..10bdbe30ac 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3751,9 +3751,9 @@ void QQuickItem::polish() /*! \internal */ -void QQuickItem::mapFromItem(QQmlV8Function *args) const +void QQuickItem::mapFromItem(QQmlV4Function *args) const { - if (args->Length() != 0) { + if (args->length() != 0) { v8::Handle<v8::Value> item = (*args)[0]; QV8Engine *engine = args->engine(); @@ -3768,14 +3768,14 @@ void QQuickItem::mapFromItem(QQmlV8Function *args) const } v8::Handle<v8::Object> rv = v8::Object::New(); - args->returnValue(rv); + args->setReturnValue(rv->v4Value()); - qreal x = (args->Length() > 1)?(*args)[1]->NumberValue():0; - qreal y = (args->Length() > 2)?(*args)[2]->NumberValue():0; + qreal x = (args->length() > 1) ? (*args)[1].asDouble() : 0; + qreal y = (args->length() > 2) ? (*args)[2].asDouble() : 0; - if (args->Length() > 3) { - qreal w = (*args)[3]->NumberValue(); - qreal h = (args->Length() > 4)?(*args)[4]->NumberValue():0; + if (args->length() > 3) { + qreal w = (*args)[3].asDouble(); + qreal h = (args->length() > 4) ? (*args)[4].asDouble() : 0; QRectF r = mapRectFromItem(itemObj, QRectF(x, y, w, h)); @@ -3823,9 +3823,9 @@ QTransform QQuickItem::itemTransform(QQuickItem *other, bool *ok) const /*! \internal */ -void QQuickItem::mapToItem(QQmlV8Function *args) const +void QQuickItem::mapToItem(QQmlV4Function *args) const { - if (args->Length() != 0) { + if (args->length() != 0) { v8::Handle<v8::Value> item = (*args)[0]; QV8Engine *engine = args->engine(); @@ -3840,14 +3840,14 @@ void QQuickItem::mapToItem(QQmlV8Function *args) const } v8::Handle<v8::Object> rv = v8::Object::New(); - args->returnValue(rv); + args->setReturnValue(rv->v4Value()); - qreal x = (args->Length() > 1)?(*args)[1]->NumberValue():0; - qreal y = (args->Length() > 2)?(*args)[2]->NumberValue():0; + qreal x = (args->length() > 1) ? (*args)[1].asDouble() : 0; + qreal y = (args->length() > 2) ? (*args)[2].asDouble() : 0; - if (args->Length() > 3) { - qreal w = (*args)[3]->NumberValue(); - qreal h = (args->Length() > 4)?(*args)[4]->NumberValue():0; + if (args->length() > 3) { + qreal w = (*args)[3].asDouble(); + qreal h = (args->length() > 4) ? (*args)[4].asDouble() : 0; QRectF r = mapRectToItem(itemObj, QRectF(x, y, w, h)); diff --git a/src/quick/items/qquickitem.h b/src/quick/items/qquickitem.h index 040f9d6888..4c99a6a9c5 100644 --- a/src/quick/items/qquickitem.h +++ b/src/quick/items/qquickitem.h @@ -80,7 +80,7 @@ private: class QCursor; class QQuickItemLayer; -class QQmlV8Function; +class QQmlV4Function; class QQuickState; class QQuickAnchorLine; class QQuickTransition; @@ -320,8 +320,8 @@ public: void polish(); - Q_INVOKABLE void mapFromItem(QQmlV8Function*) const; - Q_INVOKABLE void mapToItem(QQmlV8Function*) const; + Q_INVOKABLE void mapFromItem(QQmlV4Function*) const; + Q_INVOKABLE void mapToItem(QQmlV4Function*) const; Q_INVOKABLE void forceActiveFocus(); Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason); Q_INVOKABLE QQuickItem *childAt(qreal x, qreal y) const; diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 8836df5c08..8a597953cc 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -564,13 +564,13 @@ void QQuickLoader::loadFromSourceComponent() \sa source, active */ -void QQuickLoader::setSource(QQmlV8Function *args) +void QQuickLoader::setSource(QQmlV4Function *args) { Q_ASSERT(args); Q_D(QQuickLoader); bool ipvError = false; - args->returnValue(QV4::Value::undefinedValue()); + args->setReturnValue(QV4::Value::undefinedValue()); v8::Handle<v8::Object> ipv = d->extractInitialPropertyValues(args, this, &ipvError); if (ipvError) return; @@ -580,7 +580,7 @@ void QQuickLoader::setSource(QQmlV8Function *args) if (!ipv.IsEmpty()) { d->disposeInitialPropertyValues(); d->initialPropertyValues = ipv->v4Value(); - d->qmlGlobalForIpv = args->qmlGlobal()->v4Value(); + d->qmlGlobalForIpv = args->qmlGlobal(); } setSource(sourceUrl, false); // already cleared and set ipv above. @@ -922,9 +922,9 @@ void QQuickLoader::geometryChanged(const QRectF &newGeometry, const QRectF &oldG QQuickItem::geometryChanged(newGeometry, oldGeometry); } -QUrl QQuickLoaderPrivate::resolveSourceUrl(QQmlV8Function *args) +QUrl QQuickLoaderPrivate::resolveSourceUrl(QQmlV4Function *args) { - QString arg = (*args)[0]->v4Value().toQString(); + QString arg = (*args)[0].toQString(); if (arg.isEmpty()) return QUrl(); @@ -933,10 +933,10 @@ QUrl QQuickLoaderPrivate::resolveSourceUrl(QQmlV8Function *args) return context->resolvedUrl(QUrl(arg)); } -v8::Handle<v8::Object> QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV8Function *args, QObject *loader, bool *error) +v8::Handle<v8::Object> QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error) { v8::Handle<v8::Object> valuemap; - if (args->Length() >= 2) { + if (args->length() >= 2) { v8::Handle<v8::Value> v = (*args)[1]; if (!v->IsObject() || v->IsArray()) { *error = true; diff --git a/src/quick/items/qquickloader_p.h b/src/quick/items/qquickloader_p.h index 6a69ccd32f..0b7f57a13b 100644 --- a/src/quick/items/qquickloader_p.h +++ b/src/quick/items/qquickloader_p.h @@ -67,7 +67,7 @@ public: bool active() const; void setActive(bool newVal); - Q_INVOKABLE void setSource(QQmlV8Function *); + Q_INVOKABLE void setSource(QQmlV4Function *); QUrl source() const; void setSource(const QUrl &); diff --git a/src/quick/items/qquickloader_p_p.h b/src/quick/items/qquickloader_p_p.h index bc30d4f43e..82b78ed25d 100644 --- a/src/quick/items/qquickloader_p_p.h +++ b/src/quick/items/qquickloader_p_p.h @@ -98,8 +98,8 @@ public: void incubatorStateChanged(QQmlIncubator::Status status); void setInitialState(QObject *o); void disposeInitialPropertyValues(); - QUrl resolveSourceUrl(QQmlV8Function *args); - v8::Handle<v8::Object> extractInitialPropertyValues(QQmlV8Function *args, QObject *loader, bool *error); + QUrl resolveSourceUrl(QQmlV4Function *args); + v8::Handle<v8::Object> extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error); virtual qreal getImplicitWidth() const; virtual qreal getImplicitHeight() const; diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 58b1f265b3..5e1b786e17 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1399,7 +1399,7 @@ QRectF QQuickTextInput::positionToRectangle(int pos) const \endlist */ -void QQuickTextInput::positionAt(QQmlV8Function *args) const +void QQuickTextInput::positionAt(QQmlV4Function *args) const { Q_D(const QQuickTextInput); @@ -1407,19 +1407,19 @@ void QQuickTextInput::positionAt(QQmlV8Function *args) const qreal y = 0; QTextLine::CursorPosition position = QTextLine::CursorBetweenCharacters; - if (args->Length() < 1) + if (args->length() < 1) return; int i = 0; v8::Handle<v8::Value> arg = (*args)[i]; x = arg->NumberValue(); - if (++i < args->Length()) { + if (++i < args->length()) { arg = (*args)[i]; y = arg->NumberValue(); } - if (++i < args->Length()) { + if (++i < args->length()) { arg = (*args)[i]; position = QTextLine::CursorPosition(arg->Int32Value()); } @@ -1436,7 +1436,7 @@ void QQuickTextInput::positionAt(QQmlV8Function *args) const pos = cursor; #endif } - args->returnValue(v8::Int32::New(pos)); + args->setReturnValue(QV4::Value::fromInt32(pos)); } int QQuickTextInputPrivate::positionAt(qreal x, qreal y, QTextLine::CursorPosition position) const diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index e66d9b4964..09c0adfcdd 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -159,7 +159,7 @@ public: }; //Auxilliary functions needed to control the TextInput from QML - Q_INVOKABLE void positionAt(QQmlV8Function *args) const; + Q_INVOKABLE void positionAt(QQmlV4Function *args) const; Q_INVOKABLE QRectF positionToRectangle(int pos) const; Q_INVOKABLE void moveCursorSelection(int pos); Q_INVOKABLE void moveCursorSelection(int pos, SelectionMode mode); |