diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-26 07:18:21 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-26 07:18:21 (GMT) |
commit | ff10e44642d65b2dde50579c4994aa9def43f4c0 (patch) | |
tree | 4de475c2238fb2c120a6f15b3e1534242154ee75 /src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | |
parent | 48d057b8f4ae70d9ea43d4a234ff63956a70c3b6 (diff) | |
download | Qt-ff10e44642d65b2dde50579c4994aa9def43f4c0.zip Qt-ff10e44642d65b2dde50579c4994aa9def43f4c0.tar.gz Qt-ff10e44642d65b2dde50579c4994aa9def43f4c0.tar.bz2 |
Handle layoutChanged() properly in QML views.
Update all visible items when layoutChanged() is emitted.
Task-number: QTBUG-13146
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 65b14cf..b4e8bda 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -714,6 +714,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)), this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int))); QObject::disconnect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); + QObject::disconnect(d->m_abstractItemModel, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged())); d->m_abstractItemModel = 0; } else if (d->m_visualItemModel) { QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)), @@ -761,6 +762,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) QObject::connect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)), this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int))); 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; return; } @@ -1332,6 +1334,12 @@ void QDeclarativeVisualDataModel::_q_dataChanged(const QModelIndex &begin, const _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, d->m_roles); } +void QDeclarativeVisualDataModel::_q_layoutChanged() +{ + Q_D(QDeclarativeVisualDataModel); + _q_itemsChanged(0, count(), d->m_roles); +} + void QDeclarativeVisualDataModel::_q_modelReset() { emit modelReset(); |