views:

634

answers:

1

Is there some way to read which row of Qt's QTableView widget is selected by user? Does it have something to do with QModelIndex class?

+2  A: 

Yes, you can use QTableView::selectionModel() (an inherited function from QAbstractItemView) which returns you a QItemSelectionModel. You then can call QItemSelectionModel::selectedIndexes(), which returns a list of QModelIndexes.

For reference, see QAbstractItemView::selectionModel().

swongu