QSqlTableModel: don't cache unchanged value in setData()
authorMark Brand <mabrand@mabrand.nl>
Fri, 28 Sep 2012 08:10:29 +0000 (10:10 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 5 Oct 2012 01:16:19 +0000 (03:16 +0200)
commit10ff9de91bedf93852f13a58287afd8831644759
treef26fa943dda21f1a4a4ee3d782e06867fefea6e6
parent838eadba0b79eab32cdf9e5d04bc2ab3541731d1
QSqlTableModel: don't cache unchanged value in setData()

This is good for performance in terms of avoiding unnecessary
database activity and keeping the cache smaller.

Detail:
This change was not included in the big refactoring of QSqlTM. The
idea was that the model shouldn't second guess the intention of the
application and maybe the application wants to cause a submit.
It was a marginal consideration.

Now I think it's clear that our interest in not unnecessarily
expanding the cache outweighs that. In addition, applications can now
call selectRow() if they worry that the database values for the row
have changed and want to set a value back again.

Test added.

Change-Id: I63814dcb63a96c6ba1c8cc227807725a954a0b68
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
src/sql/models/qsqltablemodel.cpp
tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp