Results 1 to 2 of 2

Thread: QProgressBar does not update when moving window

  1. #1
    Join Date
    Feb 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QProgressBar does not update when moving window

    Hi everybody,
    I'm relatively new to Qt. I've searched for a similar problem but could not find any help. So here's my problem:

    My program's execution has a loop where most of the processing happens. I have a QProgressBar to show the progress in the main window. To update the QProgressBar i use qApp->processEvents(). To block any re-entries i disable all QPushButtons and other possible inputs during loop execution. It's working fine but when I move the window everything pauses until i finish this movement. Then the program continues and QProgressBar updates normally.

    What I want is that even when i move the window the program will continue execution and QProgressBar will update normally. I've already tried using processEvents() with arguments but it didn't work. I also tried using repaint() in QProgressBar. It works but then when I try to move the window all the gui freezes until the operations are complete and only then it updates.

    I've looked around and I've seen that using QThread is a possible solution. But since I'm not very experienced with thread programming I'd like to ask if there is any other solution in moving the window, updating QProgressBar and continuing loop execution at the same time.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QProgressBar does not update when moving window

    You can do your computation in a separate thread, but all GUI activity has to take place in the main application thread. Unfortunately, because it looks like dragging the window freezes the main event loop, none of the progress signals sent from the thread will be processed either and your GUI will stay frozen.

    Moving windows around on screen is a window manager (ie. Windows Explorer) function and is probably out of the control of Qt. Wiser heads may know better.

Similar Threads

  1. QSqlQuery Exec and QProgressBar Update
    By zerokewl in forum Qt Programming
    Replies: 2
    Last Post: 7th September 2013, 13:26
  2. Update scene after moving QGraphicsItem
    By rogerholmes in forum Newbie
    Replies: 1
    Last Post: 19th January 2010, 05:08
  3. update the QProgressBar
    By aloha in forum Newbie
    Replies: 16
    Last Post: 23rd April 2009, 20:07
  4. QProgressBar in a new window
    By tommy in forum Qt Programming
    Replies: 2
    Last Post: 13th March 2009, 17:24
  5. Problem in QProgressBar update
    By nikhilqt in forum Qt Programming
    Replies: 0
    Last Post: 10th March 2009, 10:20

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.