PDA

View Full Version : infinite loop



zakis
4th November 2009, 17:44
hello guys.



int k=1;
while(k<= ui->spinBox->value() || ui->checkBox->isChecked())
{
do something
k++
}


i try to start a loop.
" k<= spinBox->value() " its a classic loop but i use the "checkBox->isChecked()" if i want the loop is Infinity .

the loop start but if i want to uncheck the checkBox i can't.how stop the loop?
how create and stop a infinite loop?

thanks

Lykurg
4th November 2009, 17:52
you are blocking the main thread with your loop, so no chances can be made through the GUI. Read the lately posted link about that issue: Keeping the GUI Responsive (http://wiki.qtcentre.org/index.php?title=Keeping_the_GUI_Responsive)