diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-10-10 12:21:12 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-11 08:56:22 +0200 |
commit | b0e83cdc1a3a80ecc26cb31ac046b6c743238d41 (patch) | |
tree | 9170ffd694ca3e8447c36f42dc30c598b1d1da5e /src/qml/types | |
parent | 979e625dc1ff257c1793bbd7ebd8001c25a11872 (diff) |
Remove usage of String pointers where not required
Change-Id: Ia533308a1641fab263d8faa8316455e8ade1c859
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 4fee073180..d6d3de8af3 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -420,6 +420,8 @@ void ListModel::set(int elementIndex, QV4::ObjectRef object, QVector<int> *roles QV4::ObjectIterator it(scope, object, QV4::ObjectIterator::WithProtoChain|QV4::ObjectIterator::EnumerableOnly); QV4::Scoped<QV4::String> propertyName(scope); QV4::ScopedValue propertyValue(scope); + QV4::ScopedString s(scope); + QV4::ScopedArrayObject a(scope); while (1) { propertyName = it.nextPropertyNameAsString(propertyValue); if (!propertyName) @@ -429,13 +431,13 @@ void ListModel::set(int elementIndex, QV4::ObjectRef object, QVector<int> *roles int roleIndex = -1; // Add the value now - if (QV4::String *s = propertyValue->asString()) { + if ((s = propertyValue)) { const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::String); roleIndex = e->setStringProperty(r, s->toQString()); } else if (propertyValue->isNumber()) { const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::Number); roleIndex = e->setDoubleProperty(r, propertyValue->asDouble()); - } else if (QV4::ArrayObject *a = propertyValue->asArrayObject()) { + } else if ((a = propertyValue)) { const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::List); ListModel *subModel = new ListModel(r.subLayout, 0, -1); @@ -1174,7 +1176,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::ValueRef QV4::Scope scope(QV8Engine::getV4(eng)); // Add the value now - if (d->asString()) { + if (d->isString()) { QString qstr = d->toQString(); roleIndex = setStringProperty(role, qstr); } else if (d->isNumber()) { |