Hello guys,
I want to figure out the difference between connecting signals of an object before moveToThread and connecting signals after moveToThread method.
Is it right that first assumption results in asynchron slot calls of mySlot and second results in synchron slot calls of mySlot?
MyObject* object = new MyObject();
object->moveToThread(thread);
connect(object,SIGNAL(mySignal()),this,SLOT(mySlot())); // asynchronous
thread->start();
QThread* thread = new QThread();
MyObject* object = new MyObject();
object->moveToThread(thread);
connect(object,SIGNAL(mySignal()),this,SLOT(mySlot())); // asynchronous
thread->start();
To copy to clipboard, switch view to plain text mode
MyObject* object = new MyObject();
connect(object,SIGNAL(mySignal()),this,SLOT(mySlot())); // synchronous
object->moveToThread(thread);
thread->start();
QThread* thread = new QThread();
MyObject* object = new MyObject();
connect(object,SIGNAL(mySignal()),this,SLOT(mySlot())); // synchronous
object->moveToThread(thread);
thread->start();
To copy to clipboard, switch view to plain text mode
Bookmarks