repaint() doesn't, well, repaint when the app doesn't have focus
-
I have a QT app that sits waiting on a socket for commands, once it gets a command it might draw a portion of the screen into a backing image, then call repaint(x,y,w,h) to update that part of the screen.
Except that I can see the client (running in Xcode) sending data down the socket, I can see the QT server receiving it, but nothing changes on the screen.
Weirdly, if I then "focus" a different window (eg: the same xcode.app instance that ran the client), the QT app will update the screen, and I see the change I've sent over the socket.
However, if I move the QT app around by the window-title-bar, it won't redraw itself.
I tried putting a timer on the QT app's "Screen" object (the centralwidget) telling it to repaint every 1/60 of a second. but that didn't seem to make any difference.
I'm currently using 'update()' on the "Screen" widget to repaint the area, but I tried calling 'repaint()' instead to see if there was some event issue - but that made no obvious difference either.
This is all on a Mac, running 15.5 with the latest Xcode installed, and QT 6.9.1
Anyone got any ideas ? I'm running dry :(
-
Never mind - seems to be related to the widget being a subclass of QOpenGLWidget. If I change it to a subclass of QWidget, I get my updates just fine.
I don't actually need QOpenGLWidget (I was just thinking it might be useful in future) so I'm good.
-