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. Update UI from background thread freezes the app

Update UI from background thread freezes the app

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.2k Views
  • 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.
  • P Offline
    P Offline
    philk
    wrote on last edited by
    #1

    I wonder whats the best way to update a progress bar on my QMainWindow implementation that reacts on QEvents sent by a background thread. The background thread can emit those events pretty fast. What happens is that when the events come in fast, the progress bar is updated but the main window reacts sluggish when u use other widgets in it our drag it around.
    I could throttle the updates using a timer probably, but is this the only way?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      Does every change actually modify the progress bar in a meaningful way? Or will many of those updates result in a progress bar that visually looks the same?

      You could send out the update event only if the value change is significant enough to warrant it.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        NicuPopescu
        wrote on last edited by
        #3

        what if you put a delay in worker thread loop?

        1 Reply Last reply
        0
        • P Offline
          P Offline
          philk
          wrote on last edited by
          #4

          It mostly updates the tooltip.

          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