PDA

View Full Version : QThreadPool and QRunnable



jimc1200
6th May 2009, 08:48
My current application design uses QThread with signals/slots to communicate to the Main GUI thread. I've just read about QThreadPool and QRunnable as a good way to manage threads without the hassle of maintaining how many threads to use. The question I have though is if it's possible to have event loop using QThreadPool and QRunnable so that I can still support signal/slots ? Thanks for any advice.

wysota
6th May 2009, 09:12
No, you have no control over the threads there so you can't accept signals in threads running runnables (but you can emit signals from there).

jimc1200
6th May 2009, 09:29
So there's no way I could use QObject subclass such as QTcpSocket and receive the signals within QRunnable subclass, correct? Thanks.

wysota
6th May 2009, 10:43
So there's no way I could use QObject subclass such as QTcpSocket and receive the signals within QRunnable subclass, correct? Thanks.

No, I don't think so.