Qtimer and Qlabel
Solved
General and Desktop
-
@najlou said in Qtimer and Qlabel:
i used QTimer::singleShot but it does not work
Well the singleshot timer works.
QTimer::singleShot(5000, this ,ui->label_camera_msg );
Doesn't the compiler give an error message for this?
ui->label_camera_msg
is not a functor, it's (presumably) aQLabel
variable....What about:
ui->label_camera_msg.setText("Something"); QTimer::singleShot(5000, this, [this]() { ui->label_camera_msg.setText(""); } );
?
-
@J-Hilk @JonB
thank you for your answer but now it only shows me the second message
I would like the first one for 5s and after he shows me the secondui->label_camera_msg->setText("Capture Caméra Avant");
QTimer::singleShot(5000, ui->label_camera_msg, &QLabel::clear );
ui->label_camera_msg->setText("Faut faire l'initialisation, Pour le vidéo"); -
@najlou you're changing the goal post here, but fine, back to lambda we go:
ui->label_camera_msg->setText("Capture Caméra Avant"); QTimer::singleShot(5000, this, [this]() { ui->label_camera_msg.setText("Faut faire l'initialisation, Pour le vidéo"); } );