Hello everyone,

I'm working on a project and in the "add" feature I want to show a single row from a QSQlTableModel where the user can input data, on a "simple" database table, it worked like a charm, but when I wanted to replicate the same pattern on my project It didn't behave as expected, here's the scenario:

1- the program is launched, displaying a newly added row and hiding the previous ones

2- The user adds data and submits it through a button

3- A slot is called through the button to submit the newly added data, hide that row and display a new one

Here's the code of the slot:

Qt Code:
  1. {
  2. model->submit();
  3.  
  4. int row = model->rowCount();
  5. for (int i=0;i<row;i++)
  6. ui->tabsave->hideRow(row); //hide the previous rows
  7.  
  8. model->setData(model->index(row,5),QTime::currentTime());
  9.  
  10.  
  11. }
To copy to clipboard, switch view to plain text mode 

Here's the code regarding the formatting and display of the Model

Qt Code:
  1. ui->tabsave->setModel(model);
  2. //model->setEditStrategy(QSqlTableModel::OnManualSubmit);
  3. model->select();
  4.  
  5. for (int i=16;i<20;i++)
  6. {
  7. ui->tabsave->hideColumn(i); //hiding some columns from the user
  8. }
  9.  
  10.  
  11. int row = model->rowCount();
  12. for (int i=0;i<row;i++)
  13. {
  14. ui->tabsave->hideRow(i);
  15.  
  16. }
  17. model->insertRow(row);
  18. model->setData(model->index(row,5),QTime::currentTime());
  19. ui->tabsave->setRowHeight(row,80);
  20.  
  21. ////////////////SLOTS//////////////
  22.  
  23. QObject::connect(ui->next_one,SIGNAL(clicked()),this,SLOT(added_next()));
To copy to clipboard, switch view to plain text mode 

Voila, Hope I'll get some help around here. Thank you very much