aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-27 16:15:38 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-30 08:05:48 +0200
commite57c2c8a0adef8949f69195573d149237814bed1 (patch)
tree12e15bc037183967cde5278dd1c08d5c2e969977 /src/quick/items
parent0e36db9f1179d1bdf0710494e98ff7aee1a2d836 (diff)
remove more uses of QV4::Value
Change-Id: I11b0b2b7626297e2c98dc77784574da4b59ba8cf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp2
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp20
-rw-r--r--src/quick/items/qquickloader.cpp9
-rw-r--r--src/quick/items/qquickloader_p_p.h2
4 files changed, 16 insertions, 17 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 826feeb331..42b74f879e 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -663,7 +663,7 @@ void QQuickCanvasItem::updatePolish()
QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(qmlEngine(this));
QV4::Scope scope(v4);
QV4::ScopedCallData callData(scope, 1);
- callData->thisObject = QV4::Value::fromReturnedValue(QV4::QObjectWrapper::wrap(v4, this));
+ callData->thisObject = QV4::QObjectWrapper::wrap(v4, this);
foreach (int key, animationCallbacks.keys()) {
QV4::ScopedFunctionObject f(scope, animationCallbacks.value(key).value());
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 7be8d0927a..422a827acb 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -127,9 +127,9 @@ static const double Q_PI = 3.14159265358979323846; // pi
V4THROW_ERROR("Not a Context2D object");
#define qClamp(val, min, max) qMin(qMax(val, min), max)
#define CHECK_RGBA(c) (c == '-' || c == '.' || (c >=0 && c <= 9))
-QColor qt_color_from_string(const QV4::Value &name)
+QColor qt_color_from_string(const QV4::ValueRef name)
{
- QByteArray str = name.toQStringNoThrow().toUtf8();
+ QByteArray str = name->toQString().toUtf8();
char *p = str.data();
int len = str.length();
@@ -911,7 +911,7 @@ struct QQuickJSContext2DImageData : public QV4::Object
DEFINE_MANAGED_VTABLE(QQuickJSContext2DImageData);
-static QV4::Value qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image)
+static QV4::ReturnedValue qt_create_image_data(qreal w, qreal h, QV8Engine* engine, const QImage& image)
{
QQuickContext2DEngineData *ed = engineData(engine);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
@@ -928,9 +928,9 @@ static QV4::Value qt_create_image_data(qreal w, qreal h, QV8Engine* engine, cons
pixelData->image = image.format() == QImage::Format_ARGB32 ? image : image.convertToFormat(QImage::Format_ARGB32);
}
- QQuickJSContext2DImageData *imageData = new (v4->memoryManager) QQuickJSContext2DImageData(v4);
+ QV4::Scoped<QQuickJSContext2DImageData> imageData(scope, new (v4->memoryManager) QQuickJSContext2DImageData(v4));
imageData->pixelData = pixelData.asValue();
- return QV4::Value::fromObject(imageData);
+ return imageData.asReturnedValue();
}
//static script functions
@@ -3244,11 +3244,11 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::Simpl
if (pa) {
qreal w = pa->image.width();
qreal h = pa->image.height();
- return qt_create_image_data(w, h, engine, QImage()).asReturnedValue();
+ return qt_create_image_data(w, h, engine, QImage());
}
} else if (arg0->isString()) {
QImage image = r->context->createPixmap(QUrl(arg0->toQStringNoThrow()))->image();
- return qt_create_image_data(image.width(), image.height(), engine, image).asReturnedValue();
+ return qt_create_image_data(image.width(), image.height(), engine, image);
}
} else if (ctx->callData->argc == 2) {
qreal w = ctx->callData->args[0].toNumber();
@@ -3258,7 +3258,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(QV4::Simpl
V4THROW_DOM(DOMEXCEPTION_NOT_SUPPORTED_ERR, "createImageData(): invalid arguments");
if (w > 0 && h > 0)
- return qt_create_image_data(w, h, engine, QImage()).asReturnedValue();
+ return qt_create_image_data(w, h, engine, QImage());
else
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "createImageData(): invalid arguments");
}
@@ -3288,9 +3288,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(QV4::SimpleCa
V4THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "getImageData(): Invalid arguments");
QImage image = r->context->canvas()->toImage(QRectF(x, y, w, h));
- QV4::Value imageData = qt_create_image_data(w, h, engine, image);
-
- return imageData.asReturnedValue();
+ return qt_create_image_data(w, h, engine, image);
}
return QV4::Encode::null();
}
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index a59c308354..48b934e1e1 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -569,13 +569,14 @@ void QQuickLoader::setSource(QQmlV4Function *args)
bool ipvError = false;
args->setReturnValue(QV4::Encode::undefined());
- QV4::Value ipv = d->extractInitialPropertyValues(args, this, &ipvError);
+ QV4::Scope scope(args->v4engine());
+ QV4::ScopedValue ipv(scope, d->extractInitialPropertyValues(args, this, &ipvError));
if (ipvError)
return;
d->clear();
QUrl sourceUrl = d->resolveSourceUrl(args);
- if (!ipv.isUndefined()) {
+ if (!ipv->isUndefined()) {
d->disposeInitialPropertyValues();
d->initialPropertyValues = ipv.asReturnedValue();
d->qmlGlobalForIpv = args->qmlGlobal();
@@ -937,7 +938,7 @@ QUrl QQuickLoaderPrivate::resolveSourceUrl(QQmlV4Function *args)
return context->resolvedUrl(QUrl(arg));
}
-QV4::Value QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error)
+QV4::ReturnedValue QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error)
{
QV4::Scope scope(args->v4engine());
QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue());
@@ -952,7 +953,7 @@ QV4::Value QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Function *arg
}
}
- return valuemap;
+ return valuemap.asReturnedValue();
}
#include <moc_qquickloader_p.cpp>
diff --git a/src/quick/items/qquickloader_p_p.h b/src/quick/items/qquickloader_p_p.h
index a24bfb892a..825cfc1bd8 100644
--- a/src/quick/items/qquickloader_p_p.h
+++ b/src/quick/items/qquickloader_p_p.h
@@ -97,7 +97,7 @@ public:
void setInitialState(QObject *o);
void disposeInitialPropertyValues();
QUrl resolveSourceUrl(QQmlV4Function *args);
- QV4::Value extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error);
+ QV4::ReturnedValue extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error);
virtual qreal getImplicitWidth() const;
virtual qreal getImplicitHeight() const;