I have some tasks, started with QtConcurrent::run()
.
Tasks has QFutureWatcher
. I know that QFutureWatcher
can watch only one Future, but when I started the same tasks from UI, how can I create `QFutureWatcher* on each task? Is it :
QFutureWatcher<void> *watcher = new QFutureWatcher;
watcher->setFuture(future);
QVector<QFutureWatcher<void>*> watchers;
watchers.push_back(watcher); // vector with pointers to each tasks watchers
or something else?
* My trouble is that I start each task from my code, but tasks executed with external DLL functions. And I have no API to stop the task. I can only wait for task is over and close task with release all related data, after I had received finished QFutureWatcher
signal.
At this moment, I use two QFutureWatchers - one is watching the first runned task, another - starts if first task is not over and watching the second task with temporary watcher and temporary slot (code the same, I creates it just for receive another watcher signal with related data) until first task is over. And it watched the same code, but I must to duplicate it for waiting first task is over, because QFutureWatcher
doesn't have queue with finished signals and related watcher.result()`s ..
1) Does Qt has any Queued task mechanism? or how can I catch multiple tasks futures?
2) QtConcurrent::run
doesn't have cancel() slot. May I use map/mapped functions with one sequence item? Does mapped API has queued processing of tasks/finished signals? How I can realize that? Thx!