float QString::toFloat(bool *ok = nullptr):
Returns the string converted to a float value.
Returns an infinity if the conversion overflows or 0.0 if the conversion fails for other reasons (e.g. underflow).
If ok is not nullptr, failure is reported by setting *ok to false, and success by setting *ok to true.
Warning: The QString content may only contain valid numerical characters which includes the plus/minus sign, the character e used in scientific notation, and the decimal point. Including the unit or additional characters leads to a conversion error.
The string conversion will always happen in the 'C' locale. For locale dependent conversion use QLocale::toFloat()
For historical reasons, this function does not handle thousands group separators. If you need to convert such numbers, use QLocale::toFloat().
参考 https://doc.qt.io/qt-5/qstring.html#toFloat