-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.1
-
None
-
Linux, qt/4.7
-
6cf397f7ac35a058096528a7ad8bfaf623b30747, 07b9a2f2f74a42c83ac95f144392437001a455bb
We had some weird thing going on while porting Listview over to the new QScroller:
Let's say you have QDeclarativeVisualDataModel vdm with 9 items and no delegate.
vdm->count() is 9 and that's ok (or not?)
now as soon as you set a delegate via QDeclarativeVisualDataModel::setDelegate(), you will get a itemsInserted() signal telling you that 9 items were inserted.
After that
vdm->count() is still 9 and that's weird now. We had 9, we got an insertion notification for another 9 and we still only have 9?
My guess is that something like this patch would make it a lot saner (0 items via count() as long as we don't have a delegate)
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index e569dd2..0199a6a 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_delegate) + return 0; return d->modelCount(); }