Thank you so much! The start function is working!
But how do I use the timer->stop() inside the STOP function in order to stop the timer that was created inside the START function ?
void MainWindow::on_pushButton_START_clicked()
{
connect(timer, SIGNAL(timeout()), this, SLOT(on_pushButton_MAIN_FUNCTION_clicked()));
timer->start(1000);
}
void MainWindow::on_pushButton_STOP_clicked()
{
...
}
void MainWindow::on_pushButton_MAIN_FUNCTION_clicked()
{
... here is the function I want to loop...
}
void MainWindow::on_pushButton_START_clicked()
{
QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(on_pushButton_MAIN_FUNCTION_clicked()));
timer->start(1000);
}
void MainWindow::on_pushButton_STOP_clicked()
{
...
}
void MainWindow::on_pushButton_MAIN_FUNCTION_clicked()
{
... here is the function I want to loop...
}
To copy to clipboard, switch view to plain text mode
Bookmarks