aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/xmllistmodel
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-04-19 13:03:42 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-04-19 13:09:28 +0200
commit8fb620db43bb861ea7950e7176106e8aaf00876b (patch)
treeecd8dbd43edca86b5acff953b3d924227e80e458 /src/imports/xmllistmodel
parent9f8c2e733202ea2bcfbc6182fe1e994b140f449a (diff)
Rename QQmlJS::VM namespace to QV4
Simplifies writing code against it (less stuff to type). Change-Id: I8ac03ca2519375a204a3245e82c4be4cf1e793eb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/imports/xmllistmodel')
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index fc918decdd..4d0c509b2d 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -43,6 +43,9 @@
#include <qqmlcontext.h>
#include <private/qqmlengine_p.h>
+#include <private/qv8engine_p.h>
+#include <private/qv4value_p.h>
+#include <private/qv4engine_p.h>
#include <QDebug>
#include <QStringList>
@@ -63,6 +66,7 @@ Q_DECLARE_METATYPE(QQuickXmlQueryResult)
QT_BEGIN_NAMESPACE
+using namespace QV4;
typedef QPair<int, int> QQuickXmlListRange;
@@ -914,16 +918,18 @@ QQmlV4Handle QQuickXmlListModel::get(int index) const
Q_D(const QQuickXmlListModel);
if (index < 0 || index >= count())
- return QQmlV4Handle::fromV8Handle(v8::Undefined());
+ return QQmlV4Handle::fromValue(Value::undefinedValue());
QQmlEngine *engine = qmlContext(this)->engine();
QV8Engine *v8engine = QQmlEnginePrivate::getV8Engine(engine);
- v8::Local<v8::Object> rv = v8::Object::New();
- for (int ii = 0; ii < d->roleObjects.count(); ++ii)
- rv->Set(v8engine->toString(d->roleObjects[ii]->name()),
- v8engine->fromVariant(d->data.value(ii).value(index)));
+ ExecutionEngine *v4engine = QV8Engine::getV4(v8engine);
+ Object *o = v4engine->newObject();
+ for (int ii = 0; ii < d->roleObjects.count(); ++ii) {
+ Property *p = o->insertMember(v4engine->newIdentifier(d->roleObjects[ii]->name()), PropertyAttributes());
+ p->value = v8engine->fromVariant(d->data.value(ii).value(index)).get()->v4Value();
+ }
- return QQmlV4Handle::fromV8Handle(rv);
+ return QQmlV4Handle::fromValue(Value::fromObject(o));
}
/*!