开发者

Qt widget failing to repaint under certain conditions

I am having a strange issue with a widget failing to repaint for a long time.

I have one non-Qt thread that plays audio and periodically posts a custom event to my GUI thread, based on audio playback position. The GUI thread reacts by generating some visual feedback (e.g., display label on top of a widget) and invoking repaint() on itself. This works great on Mac OSX and it works fine within a unit test application I have that exercises the functionality on Windows (XP & 7), however, the widget does not properly repaint in my real application, on Windows XP/7, until the audio playback finishes.

Proper behaviour observed on OSX and within my unit test:

-> Custom Event
-> QEvent::Paint (12)
-> Custom Event
-> QEvent::Paint (12)
etc.

Wrong behaviour observed in my actual application:

-> Custom Event 
-> QEvent::UpdateRequest (77)
-> Cust开发者_StackOverflow社区om Event  
-> QEvent::UpdateRequest (77)
etc.
-> QEvent::Paint (12)

I have tried various things to force the repaint to occur, e.g., QCoreApplication::processEvents, but all to no avail. I have also tried eliminating the inter-thread events as a culprit and used a periodic timer to poll the current audio position from the GUI thread and update the widget, also without much luck.

Any ideas on how to further diagnose this would be greatly appreciated!


Did you try calling the paint event handler directly? i.e. paintEvent(NULL)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜