Question

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?

Was it helpful?

Solution

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().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top