double d = 12.345689;
str = QString("delta: %1").arg(d, 0,'e',4);
//输出为:"delta: 1.234e+01"
qDebug() << QObject::tr("arg(d, 0,'e',4):") << str;
str = QString("delta: %1").arg(d, 0,'E',4);
//输出为:"delta: 1.234E+01"
qDebug() << QObject::tr("arg(d, 0,'E',4):") << str;
// "arg(d, 0,'e',4):" "delta: 1.2346e+01"
// "arg(d, 0,'E',4):" "delta: 1.2346E+01"
来源:CSDN
作者:如意娘
链接:https://blog.csdn.net/qq_40243430/article/details/104671640