aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmllistmodel.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-02 15:07:35 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-09 10:27:57 +0100
commitca977a0c8fa25d5df4dbddba08bc2fb022df7c1c (patch)
tree24953329bba5bbb7ea8611d09098b8a6c8ba39c3 /src/qml/types/qqmllistmodel.cpp
parent7041eb353a4ad416f51245cc17342e16b3a02a9b (diff)
Cleanup variant conversion code
Make public methods proper members of the ExecutionEngine, and move private methods into the .cpp file only. Change-Id: I3ca49e39bb1c4e559a2c63346e6ae6cfa446147d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types/qqmllistmodel.cpp')
-rw-r--r--src/qml/types/qqmllistmodel.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 7613ba7ce6..0abc62b2bf 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -885,7 +885,7 @@ int ListElement::setVariantMapProperty(const ListLayout::Role &role, QV4::Object
QVariantMap *map = reinterpret_cast<QVariantMap *>(mem);
map->~QMap();
}
- new (mem) QVariantMap(QV4::ExecutionEngine::variantMapFromJS(o));
+ new (mem) QVariantMap(o->engine()->variantMapFromJS(o));
roleIndex = role.index;
}
@@ -966,7 +966,7 @@ void ListElement::setVariantMapFast(const ListLayout::Role &role, QV4::Object *o
{
char *mem = getPropertyMemory(role);
QVariantMap *map = new (mem) QVariantMap;
- *map = QV4::ExecutionEngine::variantMapFromJS(o);
+ *map = o->engine()->variantMapFromJS(o);
}
void ListElement::setDateTimePropertyFast(const ListLayout::Role &role, const QDateTime &dt)
@@ -1262,7 +1262,7 @@ void ModelNodeMetaObject::propertyWritten(int index)
QVariant value = operator[](index);
QV4::Scope scope(m_obj->m_model->engine());
- QV4::ScopedValue v(scope, QV4::ExecutionEngine::fromVariant(scope.engine, value));
+ QV4::ScopedValue v(scope, scope.engine->fromVariant(value));
int roleIndex = m_obj->m_model->m_listModel->setExistingProperty(m_obj->m_elementIndex, propName, v, scope.engine);
if (roleIndex != -1) {
@@ -1983,7 +1983,7 @@ void QQmlListModel::insert(QQmlV4Function *args)
argObject = objectArray->getIndexed(i);
if (m_dynamicRoles) {
- m_modelObjects.insert(index+i, DynamicRoleModelNode::create(QV4::ExecutionEngine::variantMapFromJS(argObject), this));
+ m_modelObjects.insert(index+i, DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this));
} else {
m_listModel->insert(index+i, argObject);
}
@@ -1993,7 +1993,7 @@ void QQmlListModel::insert(QQmlV4Function *args)
emitItemsAboutToBeInserted(index, 1);
if (m_dynamicRoles) {
- m_modelObjects.insert(index, DynamicRoleModelNode::create(QV4::ExecutionEngine::variantMapFromJS(argObject), this));
+ m_modelObjects.insert(index, DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this));
} else {
m_listModel->insert(index, argObject);
}
@@ -2093,7 +2093,7 @@ void QQmlListModel::append(QQmlV4Function *args)
argObject = objectArray->getIndexed(i);
if (m_dynamicRoles) {
- m_modelObjects.append(DynamicRoleModelNode::create(QV4::ExecutionEngine::variantMapFromJS(argObject), this));
+ m_modelObjects.append(DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this));
} else {
m_listModel->append(argObject);
}
@@ -2106,7 +2106,7 @@ void QQmlListModel::append(QQmlV4Function *args)
if (m_dynamicRoles) {
index = m_modelObjects.count();
emitItemsAboutToBeInserted(index, 1);
- m_modelObjects.append(DynamicRoleModelNode::create(QV4::ExecutionEngine::variantMapFromJS(argObject), this));
+ m_modelObjects.append(DynamicRoleModelNode::create(scope.engine->variantMapFromJS(argObject), this));
} else {
index = m_listModel->elementCount();
emitItemsAboutToBeInserted(index, 1);
@@ -2207,7 +2207,7 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
emitItemsAboutToBeInserted(index, 1);
if (m_dynamicRoles) {
- m_modelObjects.append(DynamicRoleModelNode::create(QV4::ExecutionEngine::variantMapFromJS(object), this));
+ m_modelObjects.append(DynamicRoleModelNode::create(scope.engine->variantMapFromJS(object), this));
} else {
m_listModel->insert(index, object);
}
@@ -2218,7 +2218,7 @@ void QQmlListModel::set(int index, const QQmlV4Handle &handle)
QVector<int> roles;
if (m_dynamicRoles) {
- m_modelObjects[index]->updateValues(QV4::ExecutionEngine::variantMapFromJS(object), roles);
+ m_modelObjects[index]->updateValues(scope.engine->variantMapFromJS(object), roles);
} else {
m_listModel->set(index, object, &roles);
}