qt-interest@trolltech.com
[Top] [All Lists]

Re: how to break the loop

Subject: Re: how to break the loop
From: Michael Russell
Date: Mon, 13 Dec 2004 11:19:53 -0600
Kuba Ober wrote:
On poniedziaÅek 13 grudzieÅ 2004 06:25 am, Navdeep Singh wrote:

Hi all,

can i break the loop by clicking event in QT 3.1 on red hat linux 9.0

I mean if i make a button on a dialog. As i click that button the
immidiately infinative loop must be interupted and come out form the loop.


The proper way: make the loop run in short chunks, and schedule them using a timer with zero expiration time.

Kuba


I'm not sure I agree that this is more generally proper than having a "Stop" button. Clearly, in some cases you can predict how long is "too long" for a loop to be running. However, I have written several small apps where I would notice immediately that something wasn't running correctly in a loop, and don't like to have to wait for a time out.

Also, I have two apps whose loops run for a very long time on most machines, one is a perceptron trainer which can run for hours or days in a loop.

What I actually prefer is a combination of chunk loops and a Stop button. Rather than check for the stop condition every time through the loop, I'll have it do it (for example) after every 250 loops as well as give output, so the user knows that it's still processing correctly (250 Files processed, 500 Files processed, etc.)

Michael

--
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>