Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QString::number() with a strange problem
Mihan last edited by
I found a little problem on [static]QString QString::number(double n, char format = 'g', int precision = 6)
QString::number(22.50, "f", 0); //it could not be "23"; QString::number(23.50, "f", 0); //it could be "24"; QString::number(22.53, "f", 0); //it could be "23";
Is that right, or could you please tell me how to round the number in this code?
If you want to round numbers properly you should use https://doc.qt.io/archives/qt-4.8/qtglobal.html#qRound instead of QString.