PDA

View Full Version : Confused with progressbar



hakermania
23rd January 2011, 10:09
I want to perform an update check, having a progressbar going from the one side to another. So, I have this code on the constructor of the dialog that shows the progressbar


ui->progressBar->setMaximum(0);
ui->progressBar->setMinimum(0);
ui->progressBar->setValue(-1); //these 3 first lines is to make the progressbar go from the one side to another
ui->progressBar->repaint(); //i don't know if this is needed
perform_check(); //after having the progressbar going, perform a check, a messagebox will be shown informing the user about the news and closing the whole dialog

(read the comments)
Unfortunately, When I launch this dialog, everything freezes till i get the first messagebox, then (even if, when I press OK to the messagebox I have this->close();) the window opens with the progressbar moving from side to side. I don't know what I'm doing wrong....
Can you help me? Thx

Lykurg
23rd January 2011, 10:59
you don't need the repaint, as you should never call that slot unless you exactly know why! Always use update()! Further you should read: http://doc.qt.nokia.com/qq/qq27-responsive-guis.html

hakermania
23rd January 2011, 11:47
Hey, thank you, it works partly, I've placed through the check process some QCoreApplication::processEvents();, the window doesn't stack for a long time, but still the dialog's UI (the one with the progressbar) isn't shown till a messagebox is shown giving information. I used this->update(); too..... :confused: