嵌入式和扇出晶圆级封装技术的发展历程 中英文版 高清电子书 Advances in embedded and fan-out wafer level packaging technologies
QT QString 设置浮点数 小数点位数
QString QString::number(double n, char format = ‘g’, int precision = 6)
Returns a string equivalent of the number n, formatted according to the specified format and precision. See Argument Formats for details.
Format | Meaning |
---|---|
e |
format as [-]9.9e[+|-]999 |
E |
format as [-]9.9E[+|-]999 |
f |
format as [-]9.9 |
g |
use e or f format, whichever is the most concise |
G |
use E or f format, whichever is the most concise |
A precision is also specified with the argument format. For the ‘e’, ‘E’, and ‘f’ formats, the precision represents the number of digits after the decimal point. For the ‘g’ and ‘G’ formats, the precision represents the maximum number of significant digits (trailing zeroes are omitted).
举个栗子
[php]
QString::number(number, ‘f’, 3);
[/php]
返回小数点后三位数值