Results 1 to 3 of 3

Thread: Window blacked out (not responding) even while updating status constantly

  1. #1
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Window blacked out (not responding) even while updating status constantly

    Hi,

    I am updating the status of a worker thread in GUI using the following code:
    Qt Code:
    1. while(!grabber->bGrabberFinished)
    2. {
    3. ui->statusBar->showMessage(grabber->status);
    4. ui->label->setText(grabber->status);
    5. ui->label->update();
    6.  
    7. ui->progressBar->setValue(grabber->progress);
    8. ui->progressBar->update();
    9.  
    10. boost::this_thread::sleep (boost::posix_time::milliseconds(40));
    11. }
    To copy to clipboard, switch view to plain text mode 

    Here, my worker thread updates the grabber object's progress and status (so the grabber object is shared between the GUI thread and the worker thread).

    Everything works fine (my GUI is updated at regular intervals), but during this process, Windows blacks out my screen as "not responding" even though the label is updated every 40 milliseconds...

    What am I doing wrong?

    Thanks,
    Chytu.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,391
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Window blacked out (not responding) even while updating status constantly

    Read this, if you haven't already : http://gutenberg.trolltech.kunder.li...sive-guis.html

  3. #3
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Window blacked out (not responding) even while updating status constantly

    Thank you very much for the link. Din't know about the timer.

    Using timer timeout() to convert the busy wait (or the sleep command) into a signal-slot thingy solved the problem...

Similar Threads

  1. Replies: 0
    Last Post: 2nd January 2010, 09:58
  2. Updating Status Bar Icon
    By nbkhwjm in forum Qt Programming
    Replies: 1
    Last Post: 8th October 2008, 05:22
  3. Status Bar in a SUB WINDOW.
    By Cutey in forum Qt Programming
    Replies: 3
    Last Post: 23rd July 2008, 08:42
  4. Window not responding
    By markcole in forum Qt Programming
    Replies: 10
    Last Post: 18th April 2007, 22:53

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.