There are two errors in your code

1) setSelectionMode takes a value of the QAbstractItemView::SelectionMode enum, not a list of model indexes
2) QItemSelectionModel::selectedRows() is an instance method, it needs to be called on an instance of QItemSelection model. That is also what the compiler tells you

Cheers,
_