diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-12-23 13:13:36 +1000 |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-12-23 13:36:24 +1000 |
commit | 16d08f97eaa7dd0469d7c9006546f86f1fd763f6 (patch) | |
tree | 3bc0dbbc9e97957ce669154d5fcc33de80f088cd /src/declarative | |
parent | 34630042ded25177b49f8e54b41269db1be42935 (diff) | |
download | qt4-tools-16d08f97eaa7dd0469d7c9006546f86f1fd763f6.tar.gz |
Models which load incrementally via fetchMore() don't work.
Call canFetchMore()/fetchMore() on setModel(), setRootIndex() and when
the last item is created.
Task-number: QTBUG-16039
Reviewed-by: Bea Lam
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 4f5213a583..bf9263bbc9 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -773,6 +773,8 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) QObject::connect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); QObject::connect(d->m_abstractItemModel, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged())); d->m_metaDataCacheable = true; + if (d->m_abstractItemModel->canFetchMore(d->m_root)) + d->m_abstractItemModel->fetchMore(d->m_root); return; } if ((d->m_visualItemModel = qvariant_cast<QDeclarativeVisualDataModel *>(model))) { @@ -870,6 +872,8 @@ void QDeclarativeVisualDataModel::setRootIndex(const QVariant &root) if (d->m_root != modelIndex) { int oldCount = d->modelCount(); d->m_root = modelIndex; + if (d->m_abstractItemModel && d->m_abstractItemModel->canFetchMore(modelIndex)) + d->m_abstractItemModel->fetchMore(modelIndex); int newCount = d->modelCount(); if (d->m_delegate && oldCount) emit itemsRemoved(0, oldCount); @@ -1094,6 +1098,8 @@ QDeclarativeItem *QDeclarativeVisualDataModel::item(int index, const QByteArray d->m_delegateValidated = true; } } + if (d->modelCount()-1 == index && d->m_abstractItemModel && d->m_abstractItemModel->canFetchMore(d->m_root)) + d->m_abstractItemModel->fetchMore(d->m_root); return item; } |