[Interest] Pause QTableView while model continues to update

Murphy, Sean smurphy at walbro.com
Wed Jul 8 20:20:33 CEST 2020


Is there a way to temporarily pause a QTableView while the underlying model continues to update?

My scenario: 
 - I have two separate QTableViews connected to a single model. 
 - The model is being fed from a continuously updating data source, i.e. a sensor. 
 - One of the views needs to remain live at all times - so as the model's data updates, the view updates immediately. 

For the other view, the user should be able to "pause" that view's display, spend as much time as they want looking at the data on that paused table, and then whenever they choose, they can un-pause that view and it returns to updating constantly. This view has to remain fully usable (scroll bars work, clicks work, etc.) while paused.

The only idea I have at the moment is to have a second model object, that is identical to the first one, except that it isn't connected to the sensor. At the time the user wants to pause the view, I copy the current data out of the main model into the second model, swap out the paused view's model out to the second model, and then swap it back to the main model when the user wants to go back live.

Am I missing something easier? The only other idea I had was that I could try to change the second view from a pure QTableView to one that inherits from QTableView and then have my own slot that disconnects/connects the signals between the model and that view based on the when the user wants to pause/resume.

Sean 




This message has been scanned for malware by Forcepoint. www.forcepoint.com


More information about the Interest mailing list