I want to retrieve data from internet and show them into a widget.
In particular, I've a widget with a
QComboBox containing some service from which I can retrieve a list of exchange markets.
When I select one item, I want to show related markets in a
QTextEdit on the same widget.
In my mind I think to do following steps:
- Send the request signal when item is selected
- Start retrieving of data from internet with
- At the same time showing a modal waiting widget (with a progress bar or similar)
- When data is retrieved and parsed, emit a signal with data received from both waiting widget (that will be closed) and to original widget which will be updated.
- If some error occurs (no internet connection, timeout etc) send another signal with the error code, received from the waiting widget that will shown the error message and then closed. No changes in original widget.
It's a good way to update a widget with data received from internet (or another slow source)? Or is there a better way, or a design pattern to follow in such cases?