这是一个随机的双数字:0.123456e+13
我想要像这样不带指数显示"0.123456">
QString s = "0.123456e+13";
double d = s.toDouble();
qDebug() << d; //0.123456e+13
//I try this solution that I search on the internet but it didn't work
double d2 = QStirng::number(d,'g',6).toDouble();
qDebug() << d2; //0.123456e+13
0.123456 e + 13→0.123456qt
显示假设您打算将0.123456e+13
显示为1234560000000
,而不是0.123456
,那么您可以使用Qt::fixed
(就像您使用std::fixed
一样):
qDebug() << Qt::fixed << d;