[Interest] Emitting signal from QThread::run()

Alejandro Exojo suy at badopi.org
Sat Feb 27 17:26:32 CET 2016


El Saturday 27 February 2016, Thiago Macieira escribió:
> On sábado, 27 de fevereiro de 2016 11:45:50 PST Syam wrote:
> > void MainWindow::someFunction()
> > {
> > 
> >    MyThread *thread = new MyThread;
> >    connect(thread, SIGNAL(mySignal()), this, SLOT(myGuiSlot()),
> > 
> > Qt::QueuedConnection);
> > 
> >    thread->start();
> > 
> > }
> > 
> > 
> > //////////////////
> > 
> > Will the above code work fine? In myGuiSlot() I am typically manipulating
> > some widgets - setting the text of a QLabel etc.
> 
> Yes. The signal will be queued anyway.

Will be queued without the explicit QueuedConnection? In other words, what 
does AutoConnection do here? run() is executed in another thread, but the 
QThread is in the same thread of MainWindow, right?

-- 
Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
http://barnacity.net/ | http://disperso.net



More information about the Interest mailing list