Results 1 to 3 of 3

Thread: QProgressDialog shown too late

  1. #1
    Join Date
    Oct 2010
    Posts
    91
    Thanks
    38

    Default QProgressDialog shown too late

    Hello again

    I would like to show a QProgressBar while a function is running:

    Qt Code:
    1. t = new QTimer(this);
    2. pd = new QProgressDialog("Operation in progress...", "Cancel", 0, 100);
    3. t->start(1000);
    4. pd->show();
    5. getTransfers(); //has some QCoreApplication::processEvents() that increment the ProgressBar
    6. t->stop();
    To copy to clipboard, switch view to plain text mode 

    The QProgressDialog is shown right after getTransfers() is finished, not before. Why?

    Kind regards,
    HomeR

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QProgressDialog shown too late

    Because the event queue is blocked.
    http://www.qtcentre.org/wiki/index.p...I%20Responsive

  3. #3
    Join Date
    Oct 2010
    Posts
    91
    Thanks
    38

    Default Re: QProgressDialog shown too late

    I had a look into "Keeping the GUI responsive" before
    and added some QCoreApplication:rocessEvents();
    inside the function getTransfers().
    Now I added another processEvents() as first entry in getTransfers(),
    but the dialog does not show up.

Similar Threads

  1. QFileDialog::getOpenFileName closing very late.
    By newtolinux in forum Qt Programming
    Replies: 3
    Last Post: 27th December 2010, 12:36
  2. How to execute a QProgressDialog once
    By franco.amato in forum Newbie
    Replies: 4
    Last Post: 16th March 2010, 16:36
  3. Need help in QProgressDialog
    By santhoshv84 in forum Qt Programming
    Replies: 3
    Last Post: 12th September 2008, 18:24
  4. QProgressDialog
    By samirg in forum Qt Programming
    Replies: 5
    Last Post: 5th September 2007, 16:37
  5. qprogressDialog
    By mickey in forum Qt Programming
    Replies: 5
    Last Post: 17th July 2006, 14:16

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.