Hi Wysota!
finally i am able now to input a new rec
I hope you mean like that:
Qt Code:
  1. void MainWindow::insertNewRow()
  2. {
  3. QString table = ui.tabellen_cb->currentText();
  4. model->setTable(table);
  5. model->setEditStrategy(QSqlTableModel::OnFieldChange);
  6. model->select();
  7.  
  8. ui.tableView->setModel(model);
  9. ui.tableView->show();
  10.  
  11. //Just insert an empty row into your model using insertRow() or insertRecord()
  12. //with an empty record
  13. QSqlRecord rec = model->record();
  14. model->insertRecord(-1, rec);
  15.  
  16. //and order the view to go into edit mode on the newly inserted row.
  17. model->setEditStrategy(QSqlTableModel::OnRowChange);
  18. }
To copy to clipboard, switch view to plain text mode