Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, March 2002
QTimer - Thread -Blocking


Message 1 in thread

Hello QDevelopers,

I want to realize a Progressbar for my DB-Application and therefor I made a
class with a QProgressbar and a QTimer. When the class is constructed the
timer starts and should increase the  Progress each second. Thats no problem
but this Progressbar is running in the same thread as the application. And
when the application works it seems that the QTimer is blocked. I thougt
that the QTimer::timeout()-SIGNAL is emitted in each case, also when
blocking work is done in same thread. The problem is that I can not use
threads, because the Progressbar should hold on when the Application holds
on.
Does anybody know a trick therefore???

Thanks very much, yours Ernest  


Message 2 in thread

On Tue, Mar 19, 2002 at 10:43:43AM +0100, Peterec, Ernst wrote:
> Hello QDevelopers,
> 
> I want to realize a Progressbar for my DB-Application and therefor I made a
> class with a QProgressbar and a QTimer. When the class is constructed the
> timer starts and should increase the  Progress each second. Thats no problem
> but this Progressbar is running in the same thread as the application. And
> when the application works it seems that the QTimer is blocked. I thougt
> that the QTimer::timeout()-SIGNAL is emitted in each case, also when
> blocking work is done in same thread. The problem is that I can not use
> threads, because the Progressbar should hold on when the Application holds
> on.
> Does anybody know a trick therefore???

in your time-consuming-code invoke qApp->processEvents () sometimes, then your
timer will start working, ..., in case you just for example wait for SQL
select to complete, you better move the time-consuming code to separate thread

> Thanks very much, yours Ernest  

martin
-- 
 [ signature omitted ] 

Attachment: pgp00002.pgp
Description: PGP signature