diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-12-16 22:33:41 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-12-16 22:33:41 (GMT) |
commit | 0cfb48518250e988c4ef0d9717e69fa1b73561b6 (patch) | |
tree | 226e8dfe694378dda49ea978540e22851ff21ad0 /src | |
parent | 87a939fa289a0d96c1f0eb10fa74b1cb89fc05f1 (diff) | |
download | Qt-0cfb48518250e988c4ef0d9717e69fa1b73561b6.zip Qt-0cfb48518250e988c4ef0d9717e69fa1b73561b6.tar.gz Qt-0cfb48518250e988c4ef0d9717e69fa1b73561b6.tar.bz2 |
Use faster listmodelinterface data accessor.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp index 6b4a773..d4d07cc 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp @@ -496,19 +496,13 @@ QVariant QmlGraphicsVisualDataModelDataMetaObject::initialValue(int propId) QHash<QByteArray,int>::const_iterator it = model->m_roleNames.find(propName); if (it != model->m_roleNames.end()) { roleToProp.insert(*it, propId); - QHash<int,QVariant> values = model->m_listModelInterface->data(data->m_index, QList<int>() << *it); - if (values.isEmpty()) - return QVariant(); - else - return values.value(*it); + QVariant value = model->m_listModelInterface->data(data->m_index, *it); + return value; } else if (model->m_roles.count() == 1 && propName == "modelData") { //for compatability with other lists, assign modelData if there is only a single role roleToProp.insert(model->m_roles.first(), propId); - QHash<int,QVariant> values = model->m_listModelInterface->data(data->m_index, QList<int>() << model->m_roles.first()); - if (values.isEmpty()) - return QVariant(); - else - return *values.begin(); + QVariant value = model->m_listModelInterface->data(data->m_index, model->m_roles.first()); + return value; } } else if (model->m_abstractItemModel) { model->ensureRoles(); |