aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/xmllistmodel
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/xmllistmodel')
-rw-r--r--src/imports/xmllistmodel/plugins.qmltypes2
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp21
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel_p.h2
-rw-r--r--src/imports/xmllistmodel/xmllistmodel.pro2
4 files changed, 17 insertions, 10 deletions
diff --git a/src/imports/xmllistmodel/plugins.qmltypes b/src/imports/xmllistmodel/plugins.qmltypes
index 2a431ebf81..d951d07719 100644
--- a/src/imports/xmllistmodel/plugins.qmltypes
+++ b/src/imports/xmllistmodel/plugins.qmltypes
@@ -40,7 +40,7 @@ Module {
Method { name: "reload" }
Method {
name: "get"
- type: "QQmlV8Handle"
+ type: "QQmlV4Handle"
Parameter { name: "index"; type: "int" }
}
Method { name: "errorString"; type: "string" }
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 7cc4e64522..c12bfee924 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -43,6 +43,10 @@
#include <qqmlcontext.h>
#include <private/qqmlengine_p.h>
+#include <private/qv8engine_p.h>
+#include <private/qv4value_p.h>
+#include <private/qv4engine_p.h>
+#include <private/qv4object_p.h>
#include <QDebug>
#include <QStringList>
@@ -63,6 +67,7 @@ Q_DECLARE_METATYPE(QQuickXmlQueryResult)
QT_BEGIN_NAMESPACE
+using namespace QV4;
typedef QPair<int, int> QQuickXmlListRange;
@@ -907,22 +912,24 @@ void QQuickXmlListModel::setNamespaceDeclarations(const QString &declarations)
var title = model.get(0).title;
\endjs
*/
-QQmlV8Handle QQuickXmlListModel::get(int index) const
+QQmlV4Handle QQuickXmlListModel::get(int index) const
{
// Must be called with a context and handle scope
Q_D(const QQuickXmlListModel);
if (index < 0 || index >= count())
- return QQmlV8Handle::fromHandle(v8::Undefined());
+ return QQmlV4Handle(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));
+ }
- return QQmlV8Handle::fromHandle(rv);
+ return QQmlV4Handle(Value::fromObject(o));
}
/*!
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
index 0a11cc6e28..ca4b7cf811 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
@@ -107,7 +107,7 @@ public:
QString namespaceDeclarations() const;
void setNamespaceDeclarations(const QString&);
- Q_INVOKABLE QQmlV8Handle get(int index) const;
+ Q_INVOKABLE QQmlV4Handle get(int index) const;
enum Status { Null, Ready, Loading, Error };
Status status() const;
diff --git a/src/imports/xmllistmodel/xmllistmodel.pro b/src/imports/xmllistmodel/xmllistmodel.pro
index c2cb4bbd89..2308f26d1b 100644
--- a/src/imports/xmllistmodel/xmllistmodel.pro
+++ b/src/imports/xmllistmodel/xmllistmodel.pro
@@ -3,7 +3,7 @@ TARGET = qmlxmllistmodelplugin
TARGETPATH = QtQuick/XmlListModel
IMPORT_VERSION = 2.0
-QT = network xmlpatterns qml-private v8-private core-private
+QT = network xmlpatterns qml-private core-private
SOURCES += qqmlxmllistmodel.cpp plugin.cpp
HEADERS += qqmlxmllistmodel_p.h