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

Mark Brand mabrand at mabrand.nl
Tue Aug 14 21:48:18 CEST 2012


Maemi Carrer wrote:
> Hello!
>
> When porting from Qt4 to Qt5 I've noticed a behavorial change in
> QSqlTableModel (I've attached a small example).

QSqlTableModel has had some major changes for Qt5. The changes file 
"dist/changes-5.0.0" lists them. Many of the changes are related to 
making the OnRowChange and OnFieldChange edit strategies more usable in 
a view. In Qt4, each edit causes the table to be requeried and the model 
reset, which breaks navigation in the view.

>
> Situation: QSqlTableModel set on a QSqlTableView
> Action: Delete row using deleteRow()
>
> Qt4 behavior: delete row from model and from table view
> Qt5 behaviour: delete row from model, empty row in view (but still
> show), vertical header now shows exclamation mark instead of index
It sounds like you are using OnFieldChange or OnRowChange strategy. This 
is by design. The deleted row remains in the cache until select() is 
called again.
>
> Inserations for example using insertRecord() are not reflected as well
> (no visible changes in the view, although data is added to the table).

This is not the expected behavior and I cannot reproduce it. Can you 
provide an example?

regards,

Mark



More information about the Development mailing list