[Qt-interest] emit signal from spawned thread
Cole, Derek
dcole at integrity-apps.com
Thu Aug 18 23:44:30 CEST 2011
Isnt that saying that I basically have to pass a reference of the QFuture to the method that I would be calling with QtConcurrent run to be able to call the progress functions, which could then be monitored by the QFutureWatcher in the master thread?
________________________________________
From: qt-interest-bounces+dcole=integrity-apps.com at qt.nokia.com [qt-interest-bounces+dcole=integrity-apps.com at qt.nokia.com] on behalf of Guido Seifert [wargand at gmx.de]
Sent: Thursday, August 18, 2011 5:31 PM
To: TrolltechInterest
Subject: Re: [Qt-interest] emit signal from spawned thread
> 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
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list