diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-07-19 05:30:06 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-07-19 05:30:06 (GMT) |
commit | b6251d31652232a6ac3a5dff54ad4229542089b1 (patch) | |
tree | 81c39b61313383fce9f6498dfe94b253c9e9a44a /src/declarative/graphicsitems | |
parent | 099f684de47b936268e7c052c9ac3f97ca7ad209 (diff) | |
download | Qt-b6251d31652232a6ac3a5dff54ad4229542089b1.zip Qt-b6251d31652232a6ac3a5dff54ad4229542089b1.tar.gz Qt-b6251d31652232a6ac3a5dff54ad4229542089b1.tar.bz2 |
Fix ListView sections with QList<QObject*>
QDeclarativeVisualDataModel::stringValue() did not handle
QList<QObject*> model types.
Task-number: QTBUG-12005
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativelistview.cpp | 2 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index fa422fd..38bc6f5 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -577,7 +577,7 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex) listItem->attached->m_prevSection = sectionAt(modelIndex-1); if (FxListItem *item = visibleItem(modelIndex+1)) listItem->attached->m_nextSection = item->attached->section(); - else + else if (modelIndex < model->count()-1) listItem->attached->m_nextSection = sectionAt(modelIndex+1); } } diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 786d6f9..cfa1c6d 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1089,6 +1089,11 @@ QString QDeclarativeVisualDataModel::stringValue(int index, const QString &name) if (d->m_visualItemModel) return d->m_visualItemModel->stringValue(index, name); + if ((!d->m_listModelInterface || !d->m_abstractItemModel) && d->m_listAccessor) { + if (QObject *object = d->m_listAccessor->at(index).value<QObject*>()) + return object->property(name.toUtf8()).toString(); + } + if ((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate) return QString(); |