使用arg对文字中的对应部分进行替换
QT帮助文档
QString QString::arg(double a, int fieldWidth = 0, char format = ‘g’, int precision = -1, QChar fillChar = QLatin1Char( ’ ’ )) const
fieldWidth表示a替换的最小空间量,其为正值时文本右对齐,负值文本左对齐。
format表示a的显示格式,具体如下表
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 |
precision表示保留几位小数