[Interest] Best way to threaded render (images) going forward?
roland at logikalsolutions.com
Fri Nov 22 14:14:04 CET 2019
On 11/22/19 5:00 AM, Wesley Krasko wrote:
> Thanks. For now anyways I'm trying to just move from QGLWidget to
> QOpenGLWidget, buy time.
> Can I get some help? In the QGLWidget one I currently have there is a
> separate thread to render and it uses QPainter.
> I'm trying to do the same for the new class but I can't seem to get a
> QPainter working no matter what! The app runs but as soon as drawing starts
> it crashes because, but I"m using similar methods to what I did before. If
> I comment out just the attempt to create QPainter, it works fine, renders
> fast just doing the glclear part. Hopefully I can attach here. There is a
> lot of "Extra" from our previous surface/class, but it's not yet used
> anyways. As mentioned, this is working as is, but where you find "//TODO
> HERE" in the code, I tried many ways to use a QPainter in the thread
> without success.
Honestly, I'm shocked you ever got it to work. The original Achilles'
Heel of Qt was the fact the GUI thread had to be the primary thread and
all GUI (QPainter) operations had to occur there. Over the years they've
added some non-rendered data classes for loading of images which could
be threaded off, but they had to be moved into an object in the GUI
thread to be rendered.
There have been many requests over the years to allow QPainter
operations outside of the primary thread. In particular for running
graphs like heart rate monitors which are just a brick on the screen the
user generally cannot interact with.
Roland Hughes, President
More information about the Interest