diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-05-08 16:22:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-08 19:57:01 +0200 |
commit | 995d65f3f4f348757363ba2a3a3c3444aa281b4e (patch) | |
tree | cae5c176847609abc33f51c065aa38b38cd6b9b9 /src/quick | |
parent | 2b0d3bf812273e762e7aa27a58909ade59590c0f (diff) |
Cleanup v8 dependencies from QQmlV8Function
... and rename it to QQmlV4Function
Change-Id: Iad72347babf62691e26306877d4f229fda127eb7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/context2d/qquickcanvasitem.cpp | 34 | ||||
-rw-r--r-- | src/quick/items/context2d/qquickcanvasitem_p.h | 6 | ||||
-rw-r--r-- | src/quick/items/qquickdrag.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickdrag_p.h | 4 | ||||
-rw-r--r-- | src/quick/items/qquickdroparea.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickdroparea_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 32 | ||||
-rw-r--r-- | src/quick/items/qquickitem.h | 6 | ||||
-rw-r--r-- | src/quick/items/qquickloader.cpp | 14 | ||||
-rw-r--r-- | src/quick/items/qquickloader_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickloader_p_p.h | 4 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 10 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput_p.h | 2 |
13 files changed, 62 insertions, 62 deletions
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); |