Traffic light
-
Im trying to change colors on a graphic view to simulate traffic lights but im not sure why the colors doesnt change when the star button is clicked
void MainWindow::empezar_ciclo(){ this->ui->Boton->hide(); sleep_asm(3); semdirE->setBrush(QBrush(Qt::red)); } void MainWindow::on_start_clicked(){ int j=3; this->ui->start->setStyleSheet("QPushButton{background:transparent;}"); MainWindow:ui->start->hide(); int s = 3; // empezar_ciclo();
when pressed the button should hide and then the brush change of color but the button waits til everything has been runned to hide thanks for your help
-
Im trying to change colors on a graphic view to simulate traffic lights but im not sure why the colors doesnt change when the star button is clicked
void MainWindow::empezar_ciclo(){ this->ui->Boton->hide(); sleep_asm(3); semdirE->setBrush(QBrush(Qt::red)); } void MainWindow::on_start_clicked(){ int j=3; this->ui->start->setStyleSheet("QPushButton{background:transparent;}"); MainWindow:ui->start->hide(); int s = 3; // empezar_ciclo();
when pressed the button should hide and then the brush change of color but the button waits til everything has been runned to hide thanks for your help
@indexhtml821 said in Traffic light:
sleep_asm(3);
Whatever this does, don't do it. It blocks the UI, no changes made will be seen till after it has returned. If you need a "delay" for some purpose use
QTimer::singleShot()
.