QSqlTableModel ... is possible update data without QAbstractmodel?
I use QSqlTableModel for show in gui a sqlite table of data. The data lines are continually added according to a ramdon pattern but about every 2-3 minutes. However, updates may take up to 0.5 to 2 seconds. So when the user looks at the QTableView, the data is added to the database, but the user does not see the change. Can SqlTableView update data in "real time" and wihout using QAbstractModel mechanism? I have a lot of tableview, and many different so the make very long my code.
these project run over ubuntu 14.04 64bit sqlite3 and qt5.6 c++.
what is a
QSqlTableView?! At least not a class that is shipped within Qt packages.
@raven-worx real sorry .... I correct the post.
Can SqlTableView update data in "real time" and wihout using QAbstractModel mechanism?
since the Qt item views are all based upon a common data source interface (QAbstractItemModel) ... no.
So my advice:
- implement a common QAbstractItemModel class
- fetch the SQL data in the background
- update the cached data in your custom model implementation with the result from the query
Share the model across views as much as possible.
@raven-worx I was hoping for some shortcuts .... but thanks the same