float QString::toFloat ( bool * ok = 0 ) const
Returns the string converted to a float value.
If a conversion error occurs, *ok is set to false; otherwise *ok is set to true. Returns 0.0 if the conversion fails.
Example:
QString str1 = "1234.56";
str1.toFloat(); // returns 1234.56
bool ok;
QString str2 = "R2D2";
str2.toFloat(&ok); // returns 0.0, sets ok to false