diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-25 13:52:15 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-28 13:33:32 +0200 |
commit | 4d40fa24c3ee8def2f27bd237fc8dec25cf3f473 (patch) | |
tree | cb4ad758f03cf204cbae1e7d086bfeaf73a64bc3 /src/imports | |
parent | abd82c68d564c97a4452a3afa2d63320e7292b30 (diff) |
Move Value::toInteger(double) and related to Primitive
Also clean up a few other direct uses of Value
Change-Id: Ie27d42c1b31b9e6d16d0a60071cb5e4e1c5b9e8b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/dialogs-private/qquickfontlistmodel.cpp | 2 | ||||
-rw-r--r-- | src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp | 2 | ||||
-rw-r--r-- | src/imports/localstorage/plugin.cpp | 16 | ||||
-rw-r--r-- | src/imports/testlib/main.cpp | 2 | ||||
-rw-r--r-- | src/imports/xmllistmodel/qqmlxmllistmodel.cpp | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/imports/dialogs-private/qquickfontlistmodel.cpp b/src/imports/dialogs-private/qquickfontlistmodel.cpp index 327f214145..96d1824ef6 100644 --- a/src/imports/dialogs-private/qquickfontlistmodel.cpp +++ b/src/imports/dialogs-private/qquickfontlistmodel.cpp @@ -221,7 +221,7 @@ QQmlV4Handle QQuickFontListModel::get(int idx) const ScopedString s(scope); for (int ii = 0; ii < d->roleNames.keys().count(); ++ii) { Property *p = o->insertMember((s = v4engine->newIdentifier(d->roleNames[Qt::UserRole + ii + 1])), PropertyAttributes()); - p->value = Value::fromReturnedValue(v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1))); + p->value = v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1)); } return QQmlV4Handle(o); diff --git a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp index 0183d67017..f2b4ff8b8f 100644 --- a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp +++ b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp @@ -159,7 +159,7 @@ QQmlV4Handle QQuickWritingSystemListModel::get(int idx) const ScopedString s(scope); for (int ii = 0; ii < d->roleNames.keys().count(); ++ii) { Property *p = o->insertMember((s = v4engine->newIdentifier(d->roleNames[Qt::UserRole + ii + 1])), PropertyAttributes()); - p->value = Value::fromReturnedValue(v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1))); + p->value = v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1)); } return QQmlV4Handle(o); diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index fdce3fe99e..1e0247cc54 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -131,7 +131,7 @@ static ReturnedValue qmlsqldatabase_version(SimpleCallContext *ctx) if (!r || r->type != QQmlSqlDatabaseWrapper::Database) V4THROW_REFERENCE("Not a SQLDatabase object"); - return Value::fromString(ctx->engine->newString(r->version)).asReturnedValue(); + return Encode(ctx->engine->newString(r->version)); } static ReturnedValue qmlsqldatabase_rows_length(SimpleCallContext *ctx) @@ -295,7 +295,7 @@ static ReturnedValue qmlsqldatabase_executeSql(SimpleCallContext *ctx) } } if (query.exec()) { - QQmlSqlDatabaseWrapper *rows = new (ctx->engine->memoryManager) QQmlSqlDatabaseWrapper(engine); + QV4::Scoped<QQmlSqlDatabaseWrapper> rows(scope, new (ctx->engine->memoryManager) QQmlSqlDatabaseWrapper(engine)); QV4::ScopedObject p(scope, databaseData(engine)->rowsProto.value()); rows->setPrototype(p.getPointer()); rows->type = QQmlSqlDatabaseWrapper::Rows; @@ -309,7 +309,7 @@ static ReturnedValue qmlsqldatabase_executeSql(SimpleCallContext *ctx) ScopedValue v(scope); resultObject->put((s = ctx->engine->newIdentifier("rowsAffected")), (v = Primitive::fromInt32(query.numRowsAffected()))); resultObject->put((s = ctx->engine->newIdentifier("insertId")), (v = engine->toString(query.lastInsertId().toString()))); - resultObject->put((s = ctx->engine->newIdentifier("rows")), (v = Value::fromObject(rows))); + resultObject->put((s = ctx->engine->newIdentifier("rows")), rows); } else { err = true; } @@ -343,8 +343,8 @@ static ReturnedValue qmlsqldatabase_changeVersion(SimpleCallContext *ctx) if (from_version != r->version) V4THROW_SQL(SQLEXCEPTION_VERSION_ERR, QQmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(r->version)); - QQmlSqlDatabaseWrapper *w = new (ctx->engine->memoryManager) QQmlSqlDatabaseWrapper(engine); - QV4::ScopedObject p(scope, databaseData(engine)->queryProto.value()); + Scoped<QQmlSqlDatabaseWrapper> w(scope, new (ctx->engine->memoryManager) QQmlSqlDatabaseWrapper(engine)); + ScopedObject p(scope, databaseData(engine)->queryProto.value()); w->setPrototype(p.getPointer()); w->type = QQmlSqlDatabaseWrapper::Query; w->database = db; @@ -358,7 +358,7 @@ static ReturnedValue qmlsqldatabase_changeVersion(SimpleCallContext *ctx) ScopedCallData callData(scope, 1); callData->thisObject = engine->global(); - callData->args[0] = Value::fromObject(w); + callData->args[0] = w; try { callback->call(callData); } catch (Exception &) { @@ -401,7 +401,7 @@ static ReturnedValue qmlsqldatabase_transaction_shared(SimpleCallContext *ctx, b QSqlDatabase db = r->database; - QQmlSqlDatabaseWrapper *w = new (ctx->engine->memoryManager) QQmlSqlDatabaseWrapper(engine); + Scoped<QQmlSqlDatabaseWrapper> w(scope, new (ctx->engine->memoryManager) QQmlSqlDatabaseWrapper(engine)); QV4::ScopedObject p(scope, databaseData(engine)->queryProto.value()); w->setPrototype(p.getPointer()); w->type = QQmlSqlDatabaseWrapper::Query; @@ -414,7 +414,7 @@ static ReturnedValue qmlsqldatabase_transaction_shared(SimpleCallContext *ctx, b if (callback) { ScopedCallData callData(scope, 1); callData->thisObject = engine->global(); - callData->args[0] = Value::fromObject(w); + callData->args[0] = w; try { callback->call(callData); } catch (Exception &) { diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index 47570afbda..3d0954768a 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -100,7 +100,7 @@ public Q_SLOTS: QQmlEngine *engine = qmlEngine(this); QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle()); QV4::Scope scope(v4); - QV4::ScopedValue s(scope, QV4::Value::fromString(v4->newString(name))); + QV4::ScopedValue s(scope, v4->newString(name)); return QQmlV4Handle(s); } diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp index c32fefe974..67504c7668 100644 --- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp +++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp @@ -928,7 +928,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const for (int ii = 0; ii < d->roleObjects.count(); ++ii) { ScopedString name(scope, v4engine->newIdentifier(d->roleObjects[ii]->name())); Property *p = o->insertMember(name, PropertyAttributes()); - p->value = Value::fromReturnedValue(v8engine->fromVariant(d->data.value(ii).value(index))); + p->value = v8engine->fromVariant(d->data.value(ii).value(index)); } return QQmlV4Handle(o); |