aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-06-26 09:43:45 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-28 14:56:04 +0200
commitf7d727f62c1f1bc0ab756a62ce51b042abf76eb5 (patch)
tree9dd5dc892fb155827e9a4aee5007884ee29e490c /src/qml/types
parent553b41c407985e5b18f089679c014d884624afbd (diff)
Get rid of QHashedV4String
This was required while we were using V8, but now we can simply pass QV4::String pointers. Change-Id: If6338e4a455d6132fe14e5e603e4fe9e477d1ffb Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmllistmodel.cpp20
-rw-r--r--src/qml/types/qqmllistmodel_p_p.h4
2 files changed, 11 insertions, 13 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 5091e46499..f371429779 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -104,10 +104,9 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(const QString &key, Role::Da
return createRole(key, type);
}
-const ListLayout::Role &ListLayout::getRoleOrCreate(const QV4::Value &key, Role::DataType type)
+const ListLayout::Role &ListLayout::getRoleOrCreate(const QV4::String *key, Role::DataType type)
{
- QHashedV4String hashedKey(key);
- QStringHash<Role *>::Node *node = roleHash.findNode(hashedKey);
+ QStringHash<Role *>::Node *node = roleHash.findNode(key);
if (node) {
const Role &r = *node->value;
if (type != r.type)
@@ -115,7 +114,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(const QV4::Value &key, Role:
return r;
}
- QString qkey = key.toQString();
+ QString qkey = key->toQString();
return createRole(qkey, type);
}
@@ -240,11 +239,10 @@ const ListLayout::Role *ListLayout::getExistingRole(const QString &key)
return r;
}
-const ListLayout::Role *ListLayout::getExistingRole(const QV4::Value &key)
+const ListLayout::Role *ListLayout::getExistingRole(const QV4::String *key)
{
Role *r = 0;
- QHashedV4String hashedKey(key);
- QStringHash<Role *>::Node *node = roleHash.findNode(hashedKey);
+ QStringHash<Role *>::Node *node = roleHash.findNode(key);
if (node)
r = node->value;
return r;
@@ -419,8 +417,8 @@ void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles,
QV4::ObjectIterator it(object, QV4::ObjectIterator::WithProtoChain|QV4::ObjectIterator::EnumerableOnly);
while (1) {
QV4::Value propertyValue;
- QV4::Value propertyName = it.nextPropertyNameAsString(&propertyValue);
- if (propertyName.isNull())
+ QV4::String *propertyName = it.nextPropertyNameAsString(&propertyValue).asString();
+ if (!propertyName)
break;
// Check if this key exists yet
@@ -485,8 +483,8 @@ void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
QV4::ObjectIterator it(object, QV4::ObjectIterator::WithProtoChain|QV4::ObjectIterator::EnumerableOnly);
while (1) {
QV4::Value propertyValue;
- QV4::Value propertyName = it.nextPropertyNameAsString(&propertyValue);
- if (propertyName.isNull())
+ QV4::String *propertyName = it.nextPropertyNameAsString(&propertyValue).asString();
+ if (!propertyName)
break;
// Add the value now
diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h
index 48cd248c32..de083a963b 100644
--- a/src/qml/types/qqmllistmodel_p_p.h
+++ b/src/qml/types/qqmllistmodel_p_p.h
@@ -209,12 +209,12 @@ public:
};
const Role *getRoleOrCreate(const QString &key, const QVariant &data);
- const Role &getRoleOrCreate(const QV4::Value &key, Role::DataType type);
+ const Role &getRoleOrCreate(const QV4::String *key, Role::DataType type);
const Role &getRoleOrCreate(const QString &key, Role::DataType type);
const Role &getExistingRole(int index) { return *roles.at(index); }
const Role *getExistingRole(const QString &key);
- const Role *getExistingRole(const QV4::Value &key);
+ const Role *getExistingRole(const QV4::String *key);
int roleCount() const { return roles.count(); }