From 549736341a2268e33159949e076e0629abeb838a Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Tue, 28 Jul 2009 15:55:28 +0200 Subject: Fixes selectionModel::hasSelection return value after model::reset After resetting the model, the selectionModel::hasSelection() of the view should return false. Fixed the corresponding autotest, which was wrong. Task-number: 256502 Reviewed-by: thierry --- src/gui/itemviews/qabstractitemview.cpp | 1 + tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 8b6b5cb..94569ec 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -960,6 +960,7 @@ void QAbstractItemView::reset() d->currentIndexSet = false; setState(NoState); setRootIndex(QModelIndex()); + d->selectionModel->reset(); } /*! diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp index ae64e51..0541b46 100644 --- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -1547,7 +1547,7 @@ void tst_QItemSelectionModel::resetModel() model.reset(); QVERIFY(view.selectionModel()->selection().isEmpty()); - QVERIFY(view.selectionModel()->hasSelection()); + QVERIFY(view.selectionModel()->hasSelection() == false); view.selectionModel()->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select); -- cgit v0.12