This question may have been answered somewhere else already, but I just can't seem to find the answer. I'm using the model/view programming to display a set of data from a sql database. I'm using the QSqlQueryModel to retrieve the data.
The database is empty initially, therefore there is nothing to display in the beginning. As data is coming in, the view doesn't get updated. Btw, the data in the database is inserted by a different thread. I though by setting the model in the view object is enough, but apprently more is needed to be done.
I tried to connect the model's dataChanged() signal to the view's update() or repaint() slot, but no dice. I explictly tested the model's dataChanged signal, and only to find it never sent the signal. I tried to run the another instance of the same program, and the 2nd instance did show the data, but new incoming data still doesn't get displayed.
Isn't the model supposed to be aware of the status of the data it is monitoring? I tried a similar example with QDirModel, the view doesn't get updated when I added or removed files in the folder that the model is monitoring.
Any help is appreciated, thanks.
code:
Qt Code:
mod->setQuery("SELECT id FROM infotable"); list->setModel(mod); list->show();To copy to clipboard, switch view to plain text mode
Bookmarks