Results 1 to 2 of 2

Thread: infinite loop

  1. #1
    Join Date
    Aug 2009
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question infinite loop

    hello guys.

    Qt Code:
    1. int k=1;
    2. while(k<= ui->spinBox->value() || ui->checkBox->isChecked())
    3. {
    4. do something
    5. k++
    6. }
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: infinite loop

    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

  3. The following user says thank you to Lykurg for this useful post:

    zakis (7th November 2009)

Similar Threads

  1. Replies: 4
    Last Post: 19th August 2009, 20:38
  2. Replies: 7
    Last Post: 6th March 2008, 19:24
  3. Infinite loop - resize parent from child
    By bitChanger in forum Qt Programming
    Replies: 3
    Last Post: 5th May 2006, 14:21
  4. is it possible to stay on a user defined infinite loop?
    By mahe2310 in forum Qt Programming
    Replies: 9
    Last Post: 24th March 2006, 15:29
  5. While statement inside the main loop
    By OnionRingOfDoom in forum Qt Programming
    Replies: 4
    Last Post: 8th February 2006, 19:17

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.