diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-19 15:46:48 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-11-19 15:54:07 (GMT) |
commit | e9767c66ac5998a3365d925a1138f19c09440696 (patch) | |
tree | 90879f815c68ca8a95534fa94257355023333e24 /src/gui/itemviews/qtreeview.cpp | |
parent | 6fd6879564929a672e9f0a5b59d9d42612e51c5a (diff) | |
download | Qt-e9767c66ac5998a3365d925a1138f19c09440696.zip Qt-e9767c66ac5998a3365d925a1138f19c09440696.tar.gz Qt-e9767c66ac5998a3365d925a1138f19c09440696.tar.bz2 |
Item views: make sure the model is connected/disconnected correctly
Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/itemviews/qtreeview.cpp')
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 8d50870b..3ad9fbb 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -215,6 +215,13 @@ void QTreeView::setModel(QAbstractItemModel *model) Q_D(QTreeView); if (model == d->model) return; + if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) { + disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)), + this, SLOT(rowsRemoved(QModelIndex,int,int))); + + disconnect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_modelAboutToBeReset())); + } + if (d->selectionModel) { // support row editing disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), d->model, SLOT(submit())); |