Hi to all,
I'm using a QTreeView to list items, I hide the QTreeView after a row selection and then show it setting correctly the current index but I don't know how to highlight the row. The following it has been my attempt (rows 18-19):

Qt Code:
  1. void frmTitoli::funModifica()
  2. {
  3. QModelIndexList selection = ui.tvView->selectionModel()->selectedRows(0);
  4.  
  5. if (!selection.empty())
  6. {
  7. QModelIndex idIndex = selection.at(0);
  8. int id = idIndex.data().toInt();
  9.  
  10. ui.tvView->hide();
  11.  
  12. ...
  13.  
  14. ui.tvView->show();
  15.  
  16. refreshView();
  17.  
  18. ui.tvView->setFocus();
  19. ui.tvView->selectionModel()->setCurrentIndex(idIndex, QItemSelectionModel::SelectCurrent);
  20. }
  21. else
  22. {
  23. QMessageBox::warning(this, tr("Attenzione!"),
  24. tr("Selezionare prima un elemento nella lista!"),
  25. }
  26. }
To copy to clipboard, switch view to plain text mode 

Thanks!!!