[Solved] Error handling on async tree model loading
-
I have a model implementing incremental data loading methods (canFetchMore/fetchMore/hasChildren/rowCount). When fetchMore() is called, I add "loading..." item as a child, send asynchronous request to the service (running in another thread) to give me real children, and return false. Sometimes user expands node which should totally have children, but does not at the moment. In that case, service returns me an error. I then need to show a message box, delete "loading..." child and let user expand the item once again later. The problem is that, when I remove the "loading..." child Qt also removes [+] branch decoration, making the item non-expandable.
What's the correct way of doing this?