Force Update QTableView + QSqlTableModel in PyQt
-
26-09-2019 - |
문제
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?
해결책
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.
제휴하지 않습니다 StackOverflow