QItemSelectionModel* selectionModel = tableView->selectionModel(); QModelIndexList selectedIndexes = selectionModel->selectedIndexes();
connect(selectionModel, &QItemSelectionModel::selectionChanged, this, &MyClass::onSelectionChanged);
selectionModel->clearSelection();This code clears the selection model, deselecting all of the selected indexes. Overall, the QItemSelectionModel class is useful for managing selected indexes in Qt's view and table widgets, and is part of the Qt GUI library.