20 lines
408 B
C
20 lines
408 B
C
|
|
#ifndef TASKCONTROL_H
|
|||
|
|
#define TASKCONTROL_H
|
|||
|
|
/** From answer by Hatter
|
|||
|
|
*
|
|||
|
|
* https://stackoverflow.com/questions/5423058/qfuture-that-can-be-cancelled-and-report-progress
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <QFutureInterfaceBase>
|
|||
|
|
|
|||
|
|
class TaskControl
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
TaskControl(QFutureInterfaceBase *f) : fu(f) { }
|
|||
|
|
bool shouldRun() const { return !fu->isCanceled(); }
|
|||
|
|
private:
|
|||
|
|
QFutureInterfaceBase *fu;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif // TASKCONTROL_H
|