Moayyad Yaghi
Moayyad Yaghi

Reputation: 3722

Force Update QTableView + QSqlTableModel in PyQt

I have a QTableView which displays data from a QSqlTableModel. I want my model to check for changes when a user hits a "refresh" button but I can't find a way to update the data. I tried the reset() and update() methods on the model without any result.

Is it possible to "re-read" from the database and update the model? How?

Upvotes: 1

Views: 3695

Answers (1)

Horst Helge
Horst Helge

Reputation: 111

As you dont state what you canged in your model, ill assume the simplest form of change (changed data).

For me model.select() works to update the data in the model and force the View to update itself.

Upvotes: 5

Related Questions