Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How run code in the backround without stack in a loop?



  • Hello I'm trying to make a ROS GUI for control my robot. I want to display the measurements that I subscribe from my robot and display to the lcds without press pushbutton, like running in the backround but not stack in a loop because I want rest functionality of the GUI .

    Here is the measurements when I push the button start measurements

    qt33.png

    I want to run this code for example, every second .

    
    
    void MainWindow::on_start_measurments_pressed()
    {
    
            ui->left_ultrasonic_lcd->display(ultrasonic_msg.y );
            ui->middle_ultrasonic_lcd->display(ultrasonic_msg.x );
            ui->right_ultrasonic_lcd->display(ultrasonic_msg.z);
            ros_f->ultrasonic_subscriber();
    }
    

  • Lifetime Qt Champion

    Hi,

    You can use a QTimer for that.


Log in to reply