[Interest] Qt Events/Signals and Loops (while ... for..)

Andre Somers andre at familiesomers.nl
Wed Aug 29 20:06:44 CEST 2012

Op 29-8-2012 16:19, Abhishek schreef:
> Hello all,
> I have a program in which on main thread I have TCP server to receive 
> messages and process on it.
>  - on one specific message TCP server start one while infinite loop
>  - to stop this loop I have another TCP message
> but while in loop I see that I am not able to receive any TCP signals.
> I tried adding QCoreApplication::processEvents()  in my loop but 
> nothing work.
> Please let me know the proper way to handle such situation.
You just have to start an eventloop, instead of sticking in your endless 
loop. If you use the Qt eventloop, you'll have no problems working with 
signals and slots in a thread. You do that by calling exec() from your 
run() method. Instead of using an endless loop, you might want to use 
things like a 0 timer.


> Happy Hacking.
> -- 
> Abhishek
> http://thezeroth.net
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120829/58447244/attachment.html>

More information about the Interest mailing list