Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Traffic light
Forum Updated to NodeBB v4.3 + New Features

Traffic light

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 255 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indexhtml821
    wrote on last edited by
    #1

    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

    JonBJ 1 Reply Last reply
    0
    • I indexhtml821

      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

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @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().

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved