Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Strange issue with widget failing to repaint for a long time, under certain conditions.
Forum Updated to NodeBB v4.3 + New Features

Strange issue with widget failing to repaint for a long time, under certain conditions.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alexlordax
    wrote on last edited by
    #1

    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)
    -> Custom 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 position from the audio thread and update the widget, also without much luck.

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

    Thanks,
    Alex

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      THis is hard to say witout looking at more code. Could you privide a small example, that reproduces the behavior?

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        alexlordax
        wrote on last edited by
        #3

        Unfortunately this seems to be systemic behavior. The smallest amount of code I was able to reduce this to is about 20,000 lines :-)

        I am really just looking for some pointers to troubleshoot this further. For example, what would cause the UpdateRequest event to be generated instead of Paint?

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          It all depends on what happens in main thread. On windows, paint is called from update, but noit directly. update triggers some flags and when the event loop handles the update request, it initiates a paint event. There is no guarantee that it is done directly.

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved