QSqlTableModel::commitAll(): replace row removal hack
authorMark Brand <mabrand@mabrand.nl>
Thu, 9 Feb 2012 23:47:33 +0000 (00:47 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 15 Feb 2012 01:36:21 +0000 (02:36 +0100)
commit555aa4439b3a4a2c5fd12b6ac155b87fe69e749f
treec6f73e6b6efe42038d940b3252d92dc212e967b0
parent76418628f14ff555242d7819e6cbcc6191c44360
QSqlTableModel::commitAll(): replace row removal hack

The purpose of the hack was to fool QSqlQueryModel into signaling the
removal of extra rows via rowsRemoved(). The extra rows are the
inserted rows generated by QSqlTableModel.

While it is important to signal the removal of all the rows before
requerying after committing changes, there is a cleaner way. The
table model should remove its rows before the query model removes its
rows.

Iterating backwards avoids having to decrement row numbers above ones
being removed.

Expected test results have been adjusted for these changes.

Change-Id: I0e8aa81f5e7b8fea5922f5ffd1cfb4a932313a10
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
src/sql/models/qsqltablemodel.cpp
tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp