'How to send data from another thread to QOpenGLWidget object in GUI thread?
I have a GUI thread where the QOpenGLWidget object is created. I use another thread to process data and generate RGBA values for an image.
I cannot call the QOpenGLWidget object in the data processing thread.
How can I send data from the data processing thread to the QOpenGLWidget object?
(The data processing thread is created using boost, so I cannot use moveToThread() which requires QThread)
Solution 1:[1]
Dont use QThread and signal slot for "realtime" data communication, it is leaky. You should use SafeQueue architecture like this: https://codetrips.com/2020/07/26/modern-c-writing-a-thread-safe-queue/
And remember to handle queue size to avoid overflow.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Karoshi |
