The example was the first thing I tried. Both approaches have the same problem that, the ui is not responding unless all the functions in process() are performed. It means the button is always being pressed and I won’t be able to release it until loop end.
For example:
void process()
{
for(int i =0; i<60000; i++)
{
if (this->stop) break;
//record to file
}
cleanup();
}
//==MainWindow==
void on_pushButton_release()
{
recorder->stop = true;
recorder->quit();
}
The pushbutton won’t be released unitl i=59999 and finish cleanup(). Is there any method I can stop tell the loop to stop anytime before i=59999?
↧