Hi there guys!

I'm having a small problem here, whenever i try to insert a QSqlRecord into a QSqlTableModel, I know that a new row is inserted (QTableView shows that) but data simply isn't displayed in the view (the fields remain blank). Here is the code:

in mainw.cpp
Qt Code:
  1. //this makes the adddialog SLOT to instantiate an "Add" dialog
  2. void mainwindow::adddialogslot() {
  3. adddialog *add = new adddialog;
  4. add->show();
  5. if (add->Accepted) {
  6. model->insertRecord(-1,add->record);
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 

in adddialog.cpp
Qt Code:
  1. void adddialog::allowinput() {
  2.  
  3. if (lineEdit_name->text().isEmpty() || lineEdit_surname->text().isEmpty()
  4. || lineEdit_phone->text().isEmpty() || lineEdit_phone1->text().isEmpty()
  5. || lineEdit_phone2->text().isEmpty() || lineEdit_phone3->text().isEmpty()
  6. || lineEdit_address->text().isEmpty() || lineEdit_year->text().isEmpty()
  7. || lineEdit_insurance->text().isEmpty() || lineEdit_HS->text().isEmpty()
  8. || lineEdit_diseases->text().isEmpty() || lineEdit_treat->text().isEmpty()
  9. || lineEdit_comp->text().isEmpty() || comboBox_day->currentText().isEmpty()
  10. || comboBox_month->currentText().isEmpty() || !(radioButton_M->isChecked() || radioButton_F->isChecked()) ) {
  11. QMessageBox::information(this, tr("Add Patient"), tr("Please fill in all of the required fields"));
  12. }
  13. else {
  14. record.setValue("name", lineEdit_name->text());
  15. record.setValue("surname", lineEdit_surname->text());
  16. if (radioButton_M->isChecked()) {
  17. record.setValue("gender", "M");
  18. }
  19. else {
  20. record.setValue("gender", "F");
  21. }
  22. record.setValue("birth date", comboBox_day->currentText() + "/" + comboBox_month->currentText() +"/"+ lineEdit_year->text());
  23. record.setValue("address", lineEdit_address->text());
  24. record.setValue("phone number", lineEdit_phone->text() + lineEdit_phone1->text() + lineEdit_phone2->text() + lineEdit_phone3->text());
  25. record.setValue("insurance number", lineEdit_insurance->text());
  26. record.setValue("health system", lineEdit_HS->text());
  27. record.setValue("diseases", lineEdit_diseases->text());
  28. record.setValue("treatments", lineEdit_treat->text());
  29. record.setValue("complications", lineEdit_comp->text());
  30. }
  31. }
To copy to clipboard, switch view to plain text mode 

What am I doing wrong? Any code samples would be greatly appreciated.

Thanks in advance,

Nefastious