Important: Please read the 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?



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

Log in to reply