summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qitemselectionmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/itemmodels/qitemselectionmodel.cpp')
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index ad36ecfbf6..67868b19e1 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -555,8 +555,10 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *m)
if (oldModel == m)
return;
- if (oldModel)
+ if (oldModel) {
+ q->reset();
disconnectModel();
+ }
// Caller has to call notify(), unless calling during construction (the common case).
model.setValueBypassingBindings(m);
@@ -593,12 +595,10 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *m)
void QItemSelectionModelPrivate::disconnectModel()
{
- Q_Q(QItemSelectionModel);
for (auto &connection : connections) {
QObject::disconnect(connection);
connection = QMetaObject::Connection();
}
- q->reset();
}
/*!