Is it possible to stop a thread through its associated QFuture object? Currently, I have started the process of capturing videos like this.
this->cameraThreadRepresentation = QtConcurrent::run(this,&MainWindow::startLiveCapturing);
Inside the startLiveCapturing-Method, an infinite loop is executed that captures images and displays them. Therefore, if the user wants to stop this process, he just has to click a button and this operation will stop. But it seems like I can't stop this thread by calling a cancel method like this?
this->cameraThreadRepresentation.cancel();
What am I doing wrong and how can I stop this thread or operation.
source share