The function does exactly what it says it does. The view may be sorting the rows, you may be using an invalid row number etc. We don't know unless you can provide a small example that demonstrates the problem. This, for example, works fine:
Qt Code:
  1. #include <QtGui>
  2. #include <QtSql>
  3. #include <QDebug>
  4.  
  5. void createConnection()
  6. {
  7. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
  8. db.setDatabaseName(":memory:");
  9. if (db.open()) {
  10. QSqlQuery query;
  11. query.exec("create table person (id int, "
  12. "firstname varchar(20), lastname varchar(20), primary key(firstname, lastname))");
  13. query.exec("insert into person values(101, 'Danny', 'Young')");
  14. query.exec("insert into person values(102, 'Christine', 'Holand')");
  15. query.exec("insert into person values(103, 'Lars', 'Gordon')");
  16. query.exec("insert into person values(104, 'Roberto', 'Robitaille')");
  17. query.exec("insert into person values(105, 'Maria', 'Papadopoulos')");
  18. }
  19. }
  20.  
  21. int main(int argc, char *argv[])
  22. {
  23. QApplication app(argc, argv);
  24. createConnection();
  25.  
  26. model.setTable("person");
  27. model.setEditStrategy(QSqlTableModel::OnManualSubmit);
  28. model.select();
  29.  
  30. QTableView view;
  31. view.setModel(&model);
  32. view.resize(640, 480);
  33. view.show();
  34.  
  35. model.insertRow(2);
  36. model.insertRow(5);
  37.  
  38. return app.exec();
  39. }
To copy to clipboard, switch view to plain text mode 
If you use the other edit strategies then you can only insert one row at a time (see QSqlTableModel::insertRows()) .