summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qtreeview.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-11-19 15:46:48 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-11-19 15:54:07 (GMT)
commite9767c66ac5998a3365d925a1138f19c09440696 (patch)
tree90879f815c68ca8a95534fa94257355023333e24 /src/gui/itemviews/qtreeview.cpp
parent6fd6879564929a672e9f0a5b59d9d42612e51c5a (diff)
downloadQt-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.cpp7
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()));