Woah this QtConcurrent stuff is mighty powerful, love Qt
. Works perfecly now, thanks!
Just a few corrections if more people use this: QFutureWatcher is also templated, so it should be QFutureWatcher<QImage>.
And in the first suggested approach:
Thread *t = new Thread;
t->setData(someData);
connect(t, SIGNAL(finished()), this, SLOT(threadFinished()));
t->run();
Thread *t = new Thread;
t->setData(someData);
connect(t, SIGNAL(finished()), this, SLOT(threadFinished()));
t->run();
To copy to clipboard, switch view to plain text mode
Calling run() directly doesn't actually spawn a new thread, start() should be called instead and it runs run() in a thread (I tried this approach before using QtConcurrent, woked too but took much more boilerplate code).
Bookmarks