I have searched and I have not found any valid solutions to my problem with QSortFilterProxyModel. I am asking in the same line with this thread
and another one here which where not answered. I need to filter the output on my tableview but also be able to edit the columns however, when QSortFilterProxyModel is called, I loose focus of the comboboxes. Is there a work around on this? Bellow is my code

Qt Code:
  1. void clsList::strModel()
  2. {
  3. strmodel = new QSqlRelationalTableModel(this);
  4. strmodel->setEditStrategy(QSqlTableModel::OnRowChange);
  5. strmodel->setTable("setCls_str");
  6. strmodel->setFilter("setCls_str.actv1=1");
  7.  
  8. int clInd = strmodel->fieldIndex("classCode");
  9. int strInd = strmodel->fieldIndex("streams");
  10. int clTInd = strmodel->fieldIndex("clTeach");
  11.  
  12. strmodel->setRelation(clInd, QSqlRelation("tblClass", "clID", "clCode"));
  13. strmodel->setRelation(strInd, QSqlRelation("tblStreams", "strID", "strName"));
  14. strmodel->setRelation(clTInd, QSqlRelation("allTeachers", "trID", "trName"));
  15.  
  16. strmodel->setHeaderData(strInd, Qt::Horizontal, tr("Stream"));
  17. strmodel->setHeaderData(clInd, Qt::Horizontal, tr("Class"));
  18. strmodel->setHeaderData(clTInd, Qt::Horizontal, tr("Teacher"));
  19.  
  20. strmodel->database().transaction();
  21. if(strmodel->submitAll())
  22. {
  23. strmodel->database().commit();
  24. }
  25. else
  26. {
  27. strmodel->database().rollback();
  28. }
  29.  
  30. if (!strmodel->select()) {
  31. showError(strmodel->lastError());
  32. return;}
  33.  
  34. strProxy = new SortFilterProxyModel(this);
  35. strProxy->setSourceModel(strmodel);
  36. strProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
  37.  
  38. ui->strmv->setModel(strProxy); // with this line all comboboxes disappear on my tableview
  39. // ui->strmv->setModel(strModel); // This line works well....with comboboxes visible on the grid
  40. //but I need to filter data according to some parameters
  41. ui->strmv->setItemDelegate(new QSqlRelationalDelegate(ui->strmv));
  42. ui->strmv->setColumnWidth(clInd,50);
  43. ui->strmv->setColumnWidth(strInd,100);
  44. ui->strmv->setColumnWidth(clTInd,100);
  45. }
To copy to clipboard, switch view to plain text mode