Hello, i am trying to make a small database redactor with QDataWidgetMapper as edit field for data and qtableview. Pressing button "add new parameter" must add a new record to model with current data from QDataWidgetMapper. Currentrly a managed to add an empty record in the end af model. How must i do it and what is the best way?
Adding some source code with model and mapper:

Qt Code:
  1. filterModel = new QSortFilterProxyModel;
  2. filterModel->setSourceModel(modelt);
  3. filterModel->setFilterKeyColumn(2);
  4. mapper = new QDataWidgetMapper(this);
  5. mapper->setModel(filterModel);
  6. mapper->addMapping(le1, 2);
  7. mapper->addMapping(le2, 1);
  8. mapper->addMapping(le3, 3);
  9. mapper->addMapping(le4, 5);
  10. mapper->addMapping(le5, 6);
  11. mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
  12. ......
  13. QPushButton* pcmd3 = new QPushButton("Add new parameter");
  14. pcmd3->setIcon(QIcon(":/icons/16x16/actions/add.png"));
  15. connect(pcmd3, SIGNAL(clicked()), this, SLOT(insertRow()));
To copy to clipboard, switch view to plain text mode 
and slot:
Qt Code:
  1. void MainWindow::insertRow()
  2. {
  3. filterModel->insertRow(filterModel->rowCount());
  4. mapper->toLast();
  5. mapper->submit();
  6. }
To copy to clipboard, switch view to plain text mode