Ok, so I'm having this problem tonight:
[...]
connect(startButton, SIGNAL(clicked()), this, SLOT(startCalculation()));
connect(stopButton, SIGNAL(clicked()), this, SLOT(stopCalculation()));
[...]
void MainWindow::startCalculation()
{
qDebug() << "hello";
this->startButton->setDisabled(true);
this->stopButton->setEnabled(true);
this->calcStatus = true;
this->calculate();
}
void MainWindow::stopCalculation()
{
this->startButton->setEnabled(true);
this->stopButton->setDisabled(true);
this->calcStatus = false;
}
void MainWindow::calculate()
{
qDebug() << "hello";
while(this->calcStatus)
{
}
}
[...]
I'm trying to make the calculate() procedure stoppable any time, but right after it is started I loose control and I can't press STOP. Of course in my future plans calculate() is going to "calculate" something real (e.g. heat transfer simulation).
Thanks for suggestions. P.