Support #6692

Question: Offline update of WStandardItemModel

Added by Mike Ackley almost 4 years ago. Updated almost 4 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:



I have a WStandardItemModel which I populate with an online 'report', then use a WTableView to display it.

The report then needs to be printed, so I copy the contents of the WStandardItemModel into a WTABLE which I use to render this into a PDF.

I want the printed report to have the same content as the online report, so I created a "offlineWStandardItemModel" instance and updated this using the same function as the online one, but from a secondary thread. The offlineWStandardItemModel is not connected to a view like the online one (which uses SetModel in the TableView).

However, I am getting into a bit of performance/locking issues because WT is treating (I assume correctly) the OfflineStandardItemModel instance as part of the Widget Tree; I wanted to update this offline model in my secondary thread, not 'joined' but just sending posts back to the main window progress bar.

However, because the offlineWStandardItemModel is treated as part of the "widget tree" it seems I cannot update this in the background without using a thread-join, or in my case 'grabbing the update lock'.

In my background thread, I grab the lock, then take about 2mins to make my report; but this causes the GUI to flash the 'waiting' prompt on the browser and ties up the online performance.

If I don't use the OfflineWStandardItemModel,I can update offline data in the background thread just fine.

So-is there a way to make my OfflineWStandardItemModel not part of the main GUI? What makes this part of the "widget tree"?

Is there an alternative, e.g. another APP instance, or another WSERVER instance?

I don't need the GUI to be updated , but want to use the same StandardItemModel from the GUI because it has formatting etc, and then I can use the same function to populate the report like the online one.

The online report is for 'one month' of data but the offline one is repeated for many months, thus the background thread.

I have studied and modelled the current solution on the server-push method, but really it's not quite what I need, since the main artefact to update is the StandardItemModel, and the only GUI interaction I need is the progress bar and a text box showing which month I am up to.

Are there any suggestions of best-practice for this kind of requirement in WT?

Any help would be greatly appreciated.



Also available in: Atom PDF