diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-24 12:13:42 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-26 09:05:19 +0200 |
commit | a57085f00b146798a0cca0d52dfa127232c3e659 (patch) | |
tree | 7b4df3f155d431aeb6f3aae01943a3411c812a7b /src/imports | |
parent | 12fd2ccd3fa2dc0133b5a3fb89f9fdf5cf721232 (diff) |
Fix API of QQmlV4Handle
Change-Id: Iac4a3fefebd33a5990408598486231a5add8e639
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/dialogs-private/qquickfontlistmodel.cpp | 4 | ||||
-rw-r--r-- | src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp | 4 | ||||
-rw-r--r-- | src/imports/testlib/main.cpp | 11 | ||||
-rw-r--r-- | src/imports/xmllistmodel/qqmlxmllistmodel.cpp | 4 |
4 files changed, 14 insertions, 9 deletions
diff --git a/src/imports/dialogs-private/qquickfontlistmodel.cpp b/src/imports/dialogs-private/qquickfontlistmodel.cpp index 233001b723..9d3b90f4d9 100644 --- a/src/imports/dialogs-private/qquickfontlistmodel.cpp +++ b/src/imports/dialogs-private/qquickfontlistmodel.cpp @@ -211,7 +211,7 @@ QQmlV4Handle QQuickFontListModel::get(int idx) const Q_D(const QQuickFontListModel); if (idx < 0 || idx >= count()) - return QQmlV4Handle(Value::undefinedValue()); + return QQmlV4Handle(Encode::undefined()); QQmlEngine *engine = qmlContext(this)->engine(); QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine); @@ -224,7 +224,7 @@ QQmlV4Handle QQuickFontListModel::get(int idx) const p->value = Value::fromReturnedValue(v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1))); } - return QQmlV4Handle(o.asValue()); + return QQmlV4Handle(o); } QQmlV4Handle QQuickFontListModel::pointSizes() diff --git a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp index ffe82fce12..0183d67017 100644 --- a/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp +++ b/src/imports/dialogs-private/qquickwritingsystemlistmodel.cpp @@ -149,7 +149,7 @@ QQmlV4Handle QQuickWritingSystemListModel::get(int idx) const Q_D(const QQuickWritingSystemListModel); if (idx < 0 || idx >= count()) - return QQmlV4Handle(Value::undefinedValue()); + return QQmlV4Handle(Encode::undefined()); QQmlEngine *engine = qmlContext(this)->engine(); QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine); @@ -162,7 +162,7 @@ QQmlV4Handle QQuickWritingSystemListModel::get(int idx) const p->value = Value::fromReturnedValue(v8engine->fromVariant(data(index(idx, 0), Qt::UserRole + ii + 1))); } - return QQmlV4Handle(o.asValue()); + return QQmlV4Handle(o); } void QQuickWritingSystemListModel::classBegin() diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index 6e4a397f4a..47570afbda 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -99,7 +99,9 @@ public Q_SLOTS: QQmlEngine *engine = qmlEngine(this); QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle()); - return QQmlV4Handle(QV4::Value::fromString(v4->newString(name))); + QV4::Scope scope(v4); + QV4::ScopedValue s(scope, QV4::Value::fromString(v4->newString(name))); + return QQmlV4Handle(s); } bool compare(const QVariant& act, const QVariant& exp) const { @@ -110,10 +112,13 @@ public Q_SLOTS: { QQmlEngine *engine = qmlEngine(this); QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine->handle()); + QV4::Scope scope(v4); QVector<QV4::ExecutionEngine::StackFrame> stack = v4->stackTrace(frameIndex + 2); - if (stack.size() > frameIndex + 1) - return QQmlV4Handle(QV4::Value::fromString(v4->newString(stack.at(frameIndex + 1).source))); + if (stack.size() > frameIndex + 1) { + QV4::ScopedValue s(scope, v4->newString(stack.at(frameIndex + 1).source)); + return QQmlV4Handle(s); + } return QQmlV4Handle(); } int callerLine(int frameIndex = 0) const diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp index 2991bd9755..c32fefe974 100644 --- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp +++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp @@ -918,7 +918,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const Q_D(const QQuickXmlListModel); if (index < 0 || index >= count()) - return QQmlV4Handle(Value::undefinedValue()); + return QQmlV4Handle(Encode::undefined()); QQmlEngine *engine = qmlContext(this)->engine(); QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine); @@ -931,7 +931,7 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const p->value = Value::fromReturnedValue(v8engine->fromVariant(d->data.value(ii).value(index))); } - return QQmlV4Handle(o.asValue()); + return QQmlV4Handle(o); } /*! |