diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-02-25 00:21:52 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-02-25 00:21:52 (GMT) |
commit | 950f3849e3bd2edd6bcc2784dbeadcb604c38e2d (patch) | |
tree | a8a55a3f9f4ddef85bab6d789a3ffb9e7e560a64 /src/declarative/graphicsitems/qdeclarativegridview.cpp | |
parent | f39bb2af2d81640d30222cd5abc31b076105dd8b (diff) | |
download | Qt-950f3849e3bd2edd6bcc2784dbeadcb604c38e2d.zip Qt-950f3849e3bd2edd6bcc2784dbeadcb604c38e2d.tar.gz Qt-950f3849e3bd2edd6bcc2784dbeadcb604c38e2d.tar.bz2 |
React to QAbstractItemModel::modelReset() signal.
Task-number: QTBUG-8494
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativegridview.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 2ef6305..b378db2 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -787,6 +787,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) disconnect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); disconnect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); disconnect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); + disconnect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); disconnect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); disconnect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); } @@ -821,6 +822,7 @@ void QDeclarativeGridView::setModel(const QVariant &model) connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); connect(d->model, SIGNAL(itemsMoved(int,int,int)), this, SLOT(itemsMoved(int,int,int))); + connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); connect(d->model, SIGNAL(destroyingItem(QDeclarativeItem*)), this, SLOT(destroyingItem(QDeclarativeItem*))); emit countChanged(); @@ -1688,6 +1690,16 @@ void QDeclarativeGridView::itemsMoved(int from, int to, int count) d->layout(removedBeforeVisible); } +void QDeclarativeGridView::modelReset() +{ + Q_D(QDeclarativeGridView); + d->clear(); + refill(); + d->moveReason = QDeclarativeGridViewPrivate::SetIndex; + d->updateCurrent(d->currentIndex); + emit countChanged(); +} + void QDeclarativeGridView::createdItem(int index, QDeclarativeItem *item) { Q_D(QDeclarativeGridView); |