How to have a window move and repaint simultaneously?
-
I'm implementing a screen magnifier window using a QWidget-subclassed window. I have some platform specific code to grab a portion of the screen and render it to a QPixmap.
In order for it to not render in a jittery fashion, what I then need to do is have my window move itself and repaint simultaneously.
Currently my method is to have a timer fire at a rapid rate (around 60 times per second), and its callback function performs the screen capture, moves the window and then immediately calls
repaint()
right after the call tomove()
. This seems to do the trick, and although Qt's docs recommend against usingrepaint()
this seems like a legitimate use case for it.However I'm wondering, is this the correct method? Or is there perhaps a better one?
-
@Guy-Gizmo said in How to have a window move and repaint simultaneously?:
its callback function performs the screen capture
Maybe you could do the whole screen capture once at the beginning? Then only magnify the part which your currently need.