PDA

View Full Version : QThread interthread communication



SABROG
11th June 2009, 16:33
Just for academic interest. I we emit signal from other thread to main thread - this call slot inside main thread context. But if we send signal from main thread to other thread this again call slot in main thread context. So i think i must create new QObject inside run() method and connect signal from main thread to slot this new object. And i don't understand why QThread object don't use moveToThread for himself from begining?

wysota
15th June 2009, 19:57
So i think i must create new QObject inside run() method and connect signal from main thread to slot this new object.
Yes, that's correct.


And i don't understand why QThread object don't use moveToThread for himself from begining?

Why would it do that? For instance you couldn't have passed it a parent in such a case...