[Qt-interest] Delay of code execution

Matthias Pospiech matthias.pospiech at gmx.de
Tue Apr 13 17:23:47 CEST 2010


Thiago Macieira schrieb:
> Em Terça-feira 13. Abril 2010, às 17.09.49, Matthias Pospiech escreveu:
>   
>> If I however use the latter approach inside a thread I see that the
>> function delay(1000) returns immediately.
>> Did I understand something wrong? Which is the recommanded solution?
>> I know that in a thread I could as well use msleep, but I would like to
>> have a solution which can be used anywhere
>> in the programm and also outside of QThread classes.
>>     
>
> The recommended solution is to not add any kind of delays.
>   
I know. However I work with external devices for which I have to wait. 
This is typically something like 100-1000 ms.
These devices mostly work with C based interfaces and do not know 
anything about a signal slot principle.
I most cases this delay is placed inside a loop and if i would introduce 
a signal slot principle using a timer to get around the delay this would
complicates the code so much that I do not see the benefit.

Matthias



More information about the Qt-interest-old mailing list