[Development] Regression / Behavioral Change in QSqlTableModel / QTableView in Qt 5

Harald Fernengel harald.fernengel at nokia.com
Wed Sep 12 10:42:20 CEST 2012


Hi,

On Tuesday 11 September 2012 14:49:22 ext Mark Brand wrote:
> We could consider removing the row from the model only after verifying
> that the corresponding record no longer exists in the database table.

One principle of the SQL module was not to try to outsmart the database. We 
use static result sets to show the data as it was at the time of the SELECT, 
so it's possible to scroll up & down and see a consistent set of data.

Once the data is modified e.g. by INSERT, DELETE, UPDATE, we must re-SELECT the 
data to show whatever is in the tables after the database performed its magic, 
as there's no way to figure out what actually happened (e.g., as Mark said, 
because of server-side triggers).

Losing the focus / selection is anoying, but we always felt that this should 
be fixed in the UI (e.g. by remembering the primary key, then re-setting focus 
after the model re-SELECTs), rather than trying to over-complicate the model.

Harald



More information about the Development mailing list