lundi 18 mai 2020

Run a function with a delay in QT

I want to create a function, let s say (qDebug() << "result" ;). I want to display the result 2 secs later, the delay must be in this function implemented. In other words :

void MainWindow::my_function(){
     // Here I need something to make a delay of 2 secs
      qDebug() << "result";
}

Is there a method or something that allows to wait 2 secs and then executes the next line ? I m looking for the easiest method on QT.

Aucun commentaire:

Enregistrer un commentaire