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?

  • That's most likely due to the way update() prevents multiple fast repaints. call repaint() instead and see if it fixes the problem without much of a loss of performance

  • Thanks, that seems to have worked :-)

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.