QObject::connect() vs thread
can i use QOjbect::connect() for threading purpose?
will execute receiveMessage() function everytime timeout signal is emitted.
i understand signals and slot mechanism well. but my question is bugging me
Your question is not clear.
What do you want to do?
In your timer example there is no extra thread involved.
You can use signals/slots across threads, you just should use Qt::QueuedConnection in connect(...).
i mean, connect() will just act as thread while the slots function is non blocking
There's no multi-threading involved here whatsoever. All code here runs in a single thread (unless the timer object and "this" actually live in different threads).
There's an event loop running in your app and timer events are just the same as any other. They get put in a queue and processed one after another.
The above will basically mean that your slot is run every time Qt processes messages. It can have very bad influence on your app responsiveness if what you do in the slot is heavy.
The most obvious question is: if you want a thread why not use an actual QThread instead of emulating it like that?