| 56 | |
| 57 | |
| 58 | QString numberToString(double value, int precision) |
| 59 | { |
| 60 | auto number = QString::number(value, 'f', precision); |
| 61 | auto i = number.length() - 1; |
| 62 | if (number.contains(QLatin1Char('.'))) |
| 63 | { |
| 64 | // Cut off trailing zeros |
| 65 | while (i > 0 && number.at(i) == QLatin1Char('0')) |
| 66 | --i; |
| 67 | if (number.at(i) == QLatin1Char('.')) |
| 68 | --i; |
| 69 | } |
| 70 | number.resize(++i); |
| 71 | return number; |
| 72 | } |
| 73 | |
| 74 | |
| 75 |
no test coverage detected