hi i need help with model view programming!!!
i have little databe of peoples, and i use Q3Table to show my table in new widget
but my "hard" teacher wants to do it with model/view
i dont know how can i do it and i have only few days for it.. can someone help me with this please ??
i really thanks in advance

show_table is the important function here.. and peoples are container type of "vector"
and sry for my bad english..

MainWindow.cpp

Qt Code:
  1. .
  2. .
  3. .
  4. #include "ui/ui_MainWindow.h"
  5. #include "MainWindow.h"
  6. #include <Q3Table>
  7. #include <QRegExp>
  8. #include <QSpinBox>
  9. #include <vector>
  10. .
  11. .
  12. .
  13. #include "ui/ui_Tab.h"
  14. #include "Tab.h"
  15. #include "Tab.cpp"
  16.  
  17. using namespace std;
  18. vector <osoba> people;
  19. .
  20. .
  21. .
  22. MainWindow::MainWindow(QWidget *parent)
  23. : QMainWindow(parent)
  24. {
  25. setupUi(this);
  26. .
  27. .
  28. .
  29. count=people.size();
  30. connectSlots();
  31. }
  32.  
  33. void MainWindow::show_table()
  34. {
  35. Tab *my_table = new Tab;
  36.  
  37. my_table->table->setNumRows(people.size());
  38. my_table->table->setColumnWidth ( 0, 115 );
  39. my_table->table->setColumnWidth ( 1, 115 );
  40. my_table->table->setColumnWidth ( 2, 70 );
  41.  
  42. for( int row= 0; row < count ; row++)
  43. {
  44. my_table->table->setText(row,0,people[row].sur_name);
  45. my_table->table->setText(row,1,people[row].first_name);
  46. my_table->table->setText(row,2,people[row].number);
  47. my_table->table->sortColumn(0,TRUE,TRUE);
  48. }
  49. my_table->table->setReadOnly(TRUE);
  50. my_table->show();
  51. }
  52. .
  53. .
  54. .
  55. void MainWindow::quit()
  56. {
  57. qApp->closeAllWindows();
  58. }
To copy to clipboard, switch view to plain text mode 

and this is my screen of this pgm..