[Qt-interest] problem with sleep

Arnold Krille arnold at arnoldarts.de
Tue Jun 23 22:25:06 CEST 2009


Hi,

On Tuesday 23 June 2009 21:25:48 mierdatutis mi wrote:
> I try have program that when I do click in a QListWidget puts in a
> QTextBrowser some text, then sleeps X seconds and then put other text but
> it doesn't works. The first text that I put ( ---DESCARGANDO SINOPSIS ---)
> never appears in the object Qtextbrowser.

You are using sleep in your thread (the main thread called QApplication:), how 
do you expect Qt's events for signals/slots and (more important) screen redraw 
to work when the thread is sleeping?

The solution is to use a slot that sets the text and do an delayed execution 
with QTimer::singleShot( X * 1000, <object_of_the_slot>, SLOT( 
<slot_signature> ) );

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090623/8a8d50c6/attachment.bin 


More information about the Qt-interest-old mailing list