[Qt-interest] emit signal from spawned thread
Guido Seifert
wargand at gmx.de
Thu Aug 18 23:31:47 CEST 2011
> How can I make this work?
By reading the documentation of QtConcurrentRun?
The object, which 'spawns' your thread (actually takes a thread from
the thread pool) is _not_ the thread object. So connecting signals
does not make much sense. Regardless where you put your connects.
>From the docs:
> To run a function in another thread, use QtConcurrent::run():
> extern void aFunction();
> QFuture<void> future = QtConcurrent::run(aFunction);
> This will run aFunction in a separate thread obtained from the default
> QThreadPool. You can use the QFuture and QFutureWatcher classes to
> monitor the status of the function.
I did not look much deeper and might have missed a trick, but I doubt
you can use QtConcurrentRun the way you want to.
Guido
More information about the Qt-interest-old
mailing list