I have a TreeView and TableView and the model is set to filterModel*(WSortFilterProxyModel) and filterModelTree*(WSortFilterProxyModel), respectively and those are set to WStandardItemModels.
I insert items to WStandardItemModel in a server thread and an inserted items shows up in the table view unless I select the node for which a row is being inserted. In such case, it crashes as given in the attached file at askRender. Will WReadOnlyProxyModel help here? If yes, what should be the model source settings?
Updated by Koen Deforche over 8 years ago
- Status changed from New to Feedback
Yes, you cannot share a model currently between multiple sessions. WReadOnlyProxyModel would help only if you do not intend to change the model (i.e. if it is static), but this is not what you are trying to do ?
Updated by navnidhi sharma over 8 years ago
Thanks for the response. I get the data from a socket and insert it continuously into the WStandardItemModel that is read only for the clients. The clients can only sort and select the data they want to see. I have defined WStandardItemModel in a singleton.
In the test, I did not use multiple clients yet. It crashes in a single client/browser test. I would like to try with the WReadOnlyProxyModel, but could you tell me the usage? Let's say, I have model(WStandardItemModel), filter(WSortFilterProxyModel), and readonly(WReadOnlyProxyModel) models. The model is being updated from the socket data and I call filter~~setSourceModel(model), filter
>setDynamicSortFilter(true), filtersetFilterKeyColumn(kSortKey), and filter~~>setFilterRole(Wt::UserRole). Except first, the last functions are only defined for filter model. How will I use readonly model?