QItemSelectionModel *model = new QItemSelectionModel(tableWidget->model()); QModelIndex index = tableWidget->model()->index(0,0); model->select(index,QItemSelectionModel::Select); tableWidget->setSelectionModel(model);