PDA

View Full Version : Does QSqlTableModel::select emit dataChanged/rowsInserted signals?



qtcentre2019
16th March 2020, 17:00
I modify database externally then call QSqlTableModel::select to reload the model. I expect dataChanged/rowsInserted signal emitted but it is actually not. How do I capture the information about the change of the database?

d_stranz
16th March 2020, 17:20
The model is probably sending layoutChanged() and/or modelReset() signals since the result of a query generally means the entire content of the model has changed.

The other signals imply that most of the model is unchanged, only the rows / columns / data ranges notified in the signal are modified. That's not the case here, and if the new results have a different number of rows than the previous, it could cause views to malfunction.