Hi

Related to a topic discussed a few months ago (http://www.qtcentre.org/threads/2393...OnManualSubmit), I find QSqlTableModel behaves unexpected, not to say buggy, if used with OnManualSubmit. This notably affects removed rows.
Removed rows are highlighted with '!' in views, but are still counted by QSqlTableModel::rowCount(). Here the implementation from qsqltablemodel.cpp
Qt Code:
  1. int QSqlTableModel::rowCount(const QModelIndex &parent) const
  2. {
  3. Q_D(const QSqlTableModel);
  4.  
  5. if (parent.isValid())
  6. return 0;
  7.  
  8. int rc = QSqlQueryModel::rowCount();
  9. if (d->strategy == OnManualSubmit) {
  10. for (QSqlTableModelPrivate::CacheMap::ConstIterator it = d->cache.constBegin();
  11. it != d->cache.constEnd(); ++it) {
  12. if (it.value().op == QSqlTableModelPrivate::Insert)
  13. ++rc;
  14. }
  15. } else if (d->insertIndex >= 0) {
  16. ++rc;
  17. }
  18. return rc;
  19. }
To copy to clipboard, switch view to plain text mode 
Line 12 checks for newly, not yet commited inserts and line 13 increments the row count accordingly. IMO, the same should be done for removed, but not yet commited rows. Somthing like the following statements is missing:
Qt Code:
  1. if (it.value().op == QSqlTableModelPrivate::Delete)
  2. --rc;
To copy to clipboard, switch view to plain text mode 
Similarly, removed rows should no longer be visible in views. This has been reported to the Qt bug tracker as suggestion (http://bugreports.qt.nokia.com/browse/QTBUG-492); why is this not considered a plain and simple bug?

Does anybody have awrapper that solves these deficiencies of QSqlTableModel?

Regards

Al_