paintEvent() not called after call to update()
-
I have a small application which displays some video data at 20 fps or lower. There is one thread receiving the video data, which calls update() on the display widget whenever a new frame is available that should be displayed. The display widget then draws this frame in the paintEvent() method.
On Windows this works quite well but I'm having problems on Linux (I'm running Ubuntu 16.04). On Linux the video is displayed, but occasionally the widget stops updating. I have done some debugging and realized that my thread still calls the update() method, but the paintEvent() method stops being called. The last call to paintEvent() does finish without blocking.
When I produce some other GUI events by resizing the window or pressing a button on the toolbar, then the widget suddenly continues to receive paintEvents() again until this issue happens again.
I think this doesn't just affect the paintEvent() but other events as well. I'm also occasionally updating some other widgets which sometimes also stops when this error occurs.
Any ideas what might be happening here?
-
Hi @wawan, it's in the documentation of the repaint method.
-
@jaggusri12 said in paintEvent() not called after call to update():
What I observed is that the paintEvent() called asynchronously.
Which is exactly how it should work...
-
@Christian-Ehrlicher As per Qt documentation Repaint , Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden. As per my understanding, Repaint should invoke the paintEvent() immediately, but It observed similar behavior both update() and repaint().