@pauledd
I would recommend using the build-in QThread mechanism to interrupt a thread:
public slots:
void doWork() {
forever() {
...
if ( QThread::currentThread()->isInterruptionRequested() ) {
return;
}
...
}
}
You can add this check to your SPI loop multiple times but avoid to call it too often, according to the dokumentation.
Add something like this to your MainWindow-Instance:
public slots:
void cancel() {
if( thread.isRunning()) {
thread.requestInterruption();
}
}
and connect this Slot to some Cancel-Button.