[PyQt] How to update an QAbstactTableModel

Simon Hibbs simon.hibbs at gmail.com
Tue Dec 8 15:14:41 GMT 2009


> I've written a stock portfolio tracker in pyqt4. The main window which
> is a QAbstractTableModel has an Update button. When I click it, the
> program gets new stock prices and updates the data in the table.
>
> My problem is that the data displayed in the table doesn't update until
> the window loses and regains focus....

If you're loading the data into the database directly using SQL, then QT
won't be aware of the change. You could tryusing
QSqlRelationalTableModel.setData() to push the data into the model. It's
described here:

http://doc.trolltech.com/4.5/qtsql.html#inserting-updating-and-deleting-records

Simon Hibbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20091208/ba3b9b7a/attachment.html


More information about the PyQt mailing list