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

Getting value from QSpinbox and setting to 1 decimal place.



  • Hi All

    I need to pull the value of a QSpinbox, set it to a double variable - but to one decimal place.

    I have set the variable:

    double decimal = ui->manualRate->value();
    

    I am wondering how I now set this double to one decimal place?

    Thanks

    J



  • decimal = static_cast<double>(qRound(decimal*10.0))/10.0


Log in to reply