[Qt-interest] strange behavior of spinbox when sleeping (Linux only)

TP paratribulations at free.fr
Sun Nov 21 20:39:10 CET 2010


Christian Gagneraud wrote:

> It seems that some of the included headers pull this function, I would
> say, yes this is the POSIX sleep.
> 
> And using sleep() in a slot sounds strange to me. sleep() should
> always be avoided as QT is an event-driven framework.
> 
> If you really want to use sleep-like things (I guess for testing
> purpose), you could use this (Try searching the web for "QT sleep"):
> 
> #include <qwaitcondition.h>
> ...
> QWaitCondition sleep;
> sleep.wait(2000);   // 2s
> ...
> 
> Or simply keep with the busy loop, since anyway you're trying to
> simulate calculation time...

Thanks Christian,

In fact, this is a behavior that I obtained one year ago in a GUI that 
(probably) didn't use sleep at all (only classical calculations). At this 
time, I took note of this strange behavior, and I only take the time now to 
report it to a Qt forum.
Unfortunately, I cannot provide the example of one year ago: it has been 
lost in a change of computer, work, etc.

So, if it is expected that sleep() in my example lead to this strange 
behavior, and lead to a different behavior on Windows, then I have to admit 
it, and wait for the next time when I will obtain an example with the same 
behavior and no sleep() inside it.

Julien


-- 
python -c "print ''.join([chr(154 - ord(c)) for c in '*9(9&(18%.\
9&1+,\'Z4(55l4('])"

"When a distinguished but elderly scientist states that something is
possible, he is almost certainly right. When he states that something is
impossible, he is very probably wrong." (first law of AC Clarke)




More information about the Qt-interest-old mailing list