summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/widgets/itemviews/qitemselectionmodel.h2
-rw-r--r--tests/auto/widgets/itemviews/qitemselectionmodel/tst_qitemselectionmodel.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qitemselectionmodel.h b/src/widgets/itemviews/qitemselectionmodel.h
index 5a117c8a1c..cfa71d0ef2 100644
--- a/src/widgets/itemviews/qitemselectionmodel.h
+++ b/src/widgets/itemviews/qitemselectionmodel.h
@@ -195,7 +195,7 @@ public:
const QAbstractItemModel *model() const;
public Q_SLOTS:
- void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
+ virtual void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command);
virtual void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command);
virtual void clear();
diff --git a/tests/auto/widgets/itemviews/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/widgets/itemviews/qitemselectionmodel/tst_qitemselectionmodel.cpp
index f7ce339854..19386d342c 100644
--- a/tests/auto/widgets/itemviews/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/widgets/itemviews/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -2675,6 +2675,12 @@ public:
using QItemSelectionModel::select;
+ void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
+ {
+ QItemSelectionModel::setCurrentIndex(index, command);
+ m_target->setCurrentIndex(index, command);
+ }
+
private:
QItemSelectionModel *m_target;
@@ -2708,6 +2714,9 @@ void tst_QItemSelectionModel::testChainedSelectionClear()
QVERIFY(selectedIndexes.size() == 0);
}
+ duplicate.setCurrentIndex(model.index(0, 0), QItemSelectionModel::NoUpdate);
+
+ QVERIFY(selectionModel.currentIndex() == duplicate.currentIndex());
}
QTEST_MAIN(tst_QItemSelectionModel)