diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-04-07 13:28:59 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-05-02 14:18:27 +0000 |
commit | d1af494793961a31747b689cf307b65d99367486 (patch) | |
tree | 1e89898065334e841ded62499331274cb9d0b230 /src/qml/types | |
parent | 3c090c80c58d99f1bd29493ef747a4f6fa915a71 (diff) |
Change Objects vtable methods to take a StringOrSymbol
This is needed for symbol support.
Change-Id: I83db21f232168710d18999fd97d912016e86d630
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 5 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 12 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel_p_p.h | 4 |
3 files changed, 15 insertions, 6 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 6915ab6e89..2cfb740ebf 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -3347,12 +3347,13 @@ public: return object.asReturnedValue(); } - static QV4::ReturnedValue get(const QV4::Managed *m, QV4::String *name, bool *hasProperty) + static QV4::ReturnedValue get(const QV4::Managed *m, QV4::StringOrSymbol *name, bool *hasProperty) { Q_ASSERT(m->as<QQmlDelegateModelGroupChangeArray>()); const QQmlDelegateModelGroupChangeArray *array = static_cast<const QQmlDelegateModelGroupChangeArray *>(m); - if (name->equals(array->engine()->id_length())) { + name->makeIdentifier(); + if (name->identifier() == array->engine()->id_length()->identifier()) { if (hasProperty) *hasProperty = true; return QV4::Encode(array->count()); diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index fd54a51b1d..40e0ec48c3 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1474,8 +1474,12 @@ void ModelNodeMetaObject::emitDirectNotifies(const int *changedRoles, int roleCo namespace QV4 { -bool ModelObject::put(Managed *m, String *name, const Value &value) +bool ModelObject::put(Managed *m, StringOrSymbol *n, const Value &value) { + if (n->isSymbol()) + return Object::put(m, n, value); + String *name = static_cast<String *>(n); + ModelObject *that = static_cast<ModelObject*>(m); ExecutionEngine *eng = that->engine(); @@ -1491,8 +1495,12 @@ bool ModelObject::put(Managed *m, String *name, const Value &value) return true; } -ReturnedValue ModelObject::get(const Managed *m, String *name, bool *hasProperty) +ReturnedValue ModelObject::get(const Managed *m, StringOrSymbol *n, bool *hasProperty) { + if (n->isSymbol()) + return Object::get(m, n, hasProperty); + String *name = static_cast<String *>(n); + const ModelObject *that = static_cast<const ModelObject*>(m); const ListLayout::Role *role = that->d()->m_model->m_listModel->getExistingRole(name); if (!role) diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index 99e9b30aff..428afb952f 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -183,8 +183,8 @@ struct ModelObject : public QObjectWrapper { struct ModelObject : public QObjectWrapper { - static bool put(Managed *m, String *name, const Value& value); - static ReturnedValue get(const Managed *m, String *name, bool *hasProperty); + static bool put(Managed *m, StringOrSymbol *name, const Value& value); + static ReturnedValue get(const Managed *m, StringOrSymbol *name, bool *hasProperty); static void advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes); V4_OBJECT2(ModelObject, QObjectWrapper) |