Hello,
suppose I have a worker thread that carries out some calculations at a certain rate and puts the result into memory, ~16MB, allocated by the main application at startup. Suppose further, a GUI contains a widget that can visualise that data. Since data production will occur at a higher frequency the GUI will be able to display, or that even makes sense to display, I am looking for a mechanism that:
- signals the availability of a new data set to the GUI
- allows the GUI to refresh as fast as it can
- prevents the GUI from blocking the data processing thread
- does not need to copy data unnecessarily
In other words, if the GUI is busy, the newData() signal should bounce off. If the GUI thread is consuming the data, the processing thread should not be impeded.
At the moment I have a QueuedConnection between the processing thread's dataAvailable() slot and the GUI's updateView() slot. The latter then obtains a pointer to the data block in the processing thread object. For now I have not implemented and double buffering.
What is the Qt way of solving this problem?
Kind regards,
peter
Bookmarks