Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

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