Hi!
I am using QTableView which is connected with some model. In the model the data is changing very fast in the background.
Is it possible to update the QTableView for example only every second?
Greetings from Vienna
Mike
Hi!
I am using QTableView which is connected with some model. In the model the data is changing very fast in the background.
Is it possible to update the QTableView for example only every second?
Greetings from Vienna
Mike
I don't think there is direct way to do so.
One way to do so is to maintain a internal state in the model, and give new data to the view only when you want it to get updated ( by emitting reset() signal from model). You need to accordingly handle all the model interface calls (rowCount(), columnCount(), data(), index(), setData(), etc).
Another way (with out maintaining internal state in model) would to maintain two instances of model, one for updating in background (not connected to any views), another to display (connected to views), when ever you wan the views to get updated, just switch the model, and use the other one for background updating again. Decision has to made keeping various factors like typical size of model, typical time to update the complete model, typical refresh time etc.
Hi Santosh,
Thxs for your answere!
It seems that I need a separate model for the TableView.
I am not sure if I understood your solution with the reset signal. You mean, when adding or delete data to the model, I dont call beginInsertRows(), but before updating the TableView I have to call model->modelReset()?
I think this is very expensive or?
I was suggesting to have two models
I meant your first way
Bookmarks