summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2016-03-24 20:37:33 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-03-24 20:37:33 +0100
commit487844fc62bdf048224d6fc3b7eaae6347d4457b (patch)
tree763dc03ad77fd5b43ef74e817423540caa015e4b /src/widgets/itemviews/qabstractitemview.cpp
parent4ed048dded34dbe2ce2842f0d40d9f54cd7571b0 (diff)
parent6cacd19db56b632964c3b2453bc273dac50446c9 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Diffstat (limited to 'src/widgets/itemviews/qabstractitemview.cpp')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index da4492a684..1bdb4352af 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -782,7 +782,13 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel)
return;
}
+ QItemSelection oldSelection;
+ QModelIndex oldCurrentIndex;
+
if (d->selectionModel) {
+ oldSelection = d->selectionModel->selection();
+ oldCurrentIndex = d->selectionModel->currentIndex();
+
disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
@@ -796,6 +802,9 @@ void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel)
this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
this, SLOT(currentChanged(QModelIndex,QModelIndex)));
+
+ selectionChanged(d->selectionModel->selection(), oldSelection);
+ currentChanged(d->selectionModel->currentIndex(), oldCurrentIndex);
}
}