Make this API virtual to make selection proxying possible.
Change-Id: Ie93c8b38c59d347026a68eae03687d9017b3d048 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
af914694d8
commit
0b293e4afc
@ -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();
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user