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

QSerialport and triggering measurements



  • Hi,
    i have a small problem with my qserialport application. Initialising the measurement device works well, but then...
    click button one to trigger the measurement works, then clickling button two to get the results works too. But if i put these together in one function, the measurement device resets.

    1. button1.click() ==> button_measure_xy(); button2.click() ==> get_result() works as often i click these two buttons

    void MainWindow::last_try()
    {
    button_measure_xy();

    QThread::msleep(500);
    
    get_result();
    

    }
    does not work. Whats different for these two solutions?

    Erni42



  • Ha,

    I worked it out by replacing the QThread::msleep witha QTimer::singelShot

    void MainWindow::last_try()
    {
        button_measure_xy();
        QTimer::singleShot(ui->spinBox->value(), this, SLOT(get_result()));
    }
    

    Erni42


Log in to reply