[Interest] Emitting signal from QThread::run()
Thiago Macieira
thiago.macieira at intel.com
Sat Feb 27 20:18:35 CET 2016
On sábado, 27 de fevereiro de 2016 17:26:32 PST Alejandro Exojo wrote:
> 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?
It would have been queued with AutoConnection, yes.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Interest
mailing list