qtconcurrent

QFuture that can be cancelled and report progress

北战南征 提交于 2019-11-28 17:38:50
The QFuture class has methods such as cancel() , progressValue() , etc. These can apparently be monitored via a QFutureWatcher . However, the documentation for QtConcurrent::run() reads: Note that the QFuture returned by QtConcurrent::run() does not support canceling, pausing, or progress reporting. The QFuture returned can only be used to query for the running/finished status and the return value of the function. I have looked in vain for what method actually can create a QFuture that can be cancelled and report progress for a single long-running operation. (It looks like maybe QtConcurrent:

QtConcurrent with member function

霸气de小男生 提交于 2019-11-28 01:32:40
问题 I create a QFuture that I want to use to parallelize calls to a member function. More precisely, I have a class solveParallel with .h : class solverParallel { public: solverParallelData(Manager* mgr_); virtual ~solverParallel(void); void runCompute(solveModel * model_); bool resultComput(); private: Manager *myMgr; QFuture<bool> myFutureCompute; }; where the methode runCompute() is creating the myFutureCompute member. .cpp looks like solveParallel::solveParallel(Manager* mgr_) :m_mgr(mgr_) {

QFuture that can be cancelled and report progress

我怕爱的太早我们不能终老 提交于 2019-11-27 20:02:39
问题 The QFuture class has methods such as cancel() , progressValue() , etc. These can apparently be monitored via a QFutureWatcher . However, the documentation for QtConcurrent::run() reads: Note that the QFuture returned by QtConcurrent::run() does not support canceling, pausing, or progress reporting. The QFuture returned can only be used to query for the running/finished status and the return value of the function. I have looked in vain for what method actually can create a QFuture that can be

is it possible to use QtConcurrent::run() with a function member of a class

我与影子孤独终老i 提交于 2019-11-27 13:02:14
问题 I can't seem to be able to associate QtConcurrent::run() with a method (function member of a class) only with a simple function. How can I do this? With a regular function I cannot emit signals and its a drag. Why would anyone find this a better alternative to QThread is beyond me and would like some input. 回答1: Yes, this is possible (and quite easy). Here is an example (from the Qt documentation): // call 'QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt: