Hi!

I have the following tables structure:

Qt Code:
  1. classes (
  2. id integer primary key,
  3. name integer
  4. );
  5.  
  6. subjects (
  7. id integer primary key,
  8. name varchar,
  9. short_name varchar
  10. );
  11.  
  12. subjects_relations (
  13. classID integer foreign key,
  14. subjectID integer foreign key
  15. );
  16.  
  17. students (
  18. id integer primary key,
  19. name varchar,
  20. surname varchar,
  21. class integer foreign key
  22. );
  23.  
  24. marks (
  25. id integer primary key,
  26. value integer, //in Poland we have digit marks ;)
  27. studentID integer foreign key,
  28. subjectID integer foreign key
  29. );
To copy to clipboard, switch view to plain text mode 

Ps.: Only one mark can be connected with specified subject and student.

Now: I want to make a table (QTableView) like this:

Qt Code:
  1. ***************| math | eng
  2. -----------------------------
  3. David Smiths | 3 | 5
  4. John Doe | 5 | 4
To copy to clipboard, switch view to plain text mode 
So: columns are subjects connected to a specified class. Rows are students from this class. Cells are marks. Columns labels are subject short_name (this is no problem) and rows labels are name and surname (this is a problem).

How to make that table with one of the Sql Models? I want to mention that I want to edit marks in table and save them with submitAll();.

Cheers,
David