PROBLEM:
In a QTableView, if a row has a null value in a combo box field (that writes in the row the value of a foreign key), the user does not see the row (!).

MORE INFORMATION:
I need to have a form where the user enters information about something in a QTableView (for the sake of clarity, I have chosen an example of a database of poems).

Some poems would have author and others not; (the author would be the foreign key). if I try a code like this:

Qt Code:
  1. model.setEditStrategy(QSqlTableModel::OnManualSubmit);
  2. model.setTable("poems");
  3. model.setRelation(3, QSqlRelation( "authors", "author_id", "name"));
  4. model.setHeaderData(0, Qt::Horizontal, t("ID"));
  5. model.setHeaderData(1, Qt::Horizontal, t("Title"));
  6. model.setHeaderData(2, Qt::Horizontal, t("Year"));
  7. model.setHeaderData(3, Qt::Horizontal, t("Author"));
  8. model.select();
  9.  
  10. QTableView table_view;
  11. table_view->setModel(model);
  12. table_view->setItemDelegate(new QSqlRelationalDelegate(table_view));
To copy to clipboard, switch view to plain text mode 

Then the rows that are poems without an author... are not shown.