PDA

View Full Version : QProgressDialog shown too late



homerun4711
17th January 2011, 16:42
Hello again :)

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



t = new QTimer(this);
pd = new QProgressDialog("Operation in progress...", "Cancel", 0, 100);
t->start(1000);
pd->show();
getTransfers(); //has some QCoreApplication::processEvents() that increment the ProgressBar
t->stop();


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

Kind regards,
HomeR

tbscope
17th January 2011, 17:04
Because the event queue is blocked.
http://www.qtcentre.org/wiki/index.php?title=Keeping%20the%20GUI%20Responsive

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