[Interest] Qt Events/Signals and Loops (while ... for..)
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.
> Interest mailing list
> Interest at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest