From 07b9a2f2f74a42c83ac95f144392437001a455bb Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 16 Nov 2010 18:25:06 +1000 Subject: Fix regression due to 6cf397f7ac35a058096528a7ad8bfaf623b30747 PathView needed to update internal item count when delegate was set. VDM::count() didn't call into the internal VDM when querying count. Task-number: QTBUG-14781 Reviewed-by: Alan Alpert --- src/declarative/graphicsitems/qdeclarativepathview.cpp | 1 + src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index e6eaa2f..7c79afe 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -1011,6 +1011,7 @@ void QDeclarativePathView::setDelegate(QDeclarativeComponent *delegate) } if (QDeclarativeVisualDataModel *dataModel = qobject_cast(d->model)) { dataModel->setDelegate(delegate); + d->modelCount = dataModel->count(); d->regenerate(); emit delegateChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 9601db0..4fe6c4c 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -937,6 +937,8 @@ void QDeclarativeVisualDataModel::setPart(const QString &part) int QDeclarativeVisualDataModel::count() const { Q_D(const QDeclarativeVisualDataModel); + if (d->m_visualItemModel) + return d->m_visualItemModel->count(); if (!d->m_delegate) return 0; return d->modelCount(); -- cgit v0.12