FINN
FINN

Reputation: 16

How to display double without exponential format in Qt?

Here is a random double number:0.123456e+13

I wanna display without exponential like this "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.123456e+13->0.123456 display in qt

Upvotes: 0

Views: 603

Answers (1)

Ranoiaetep
Ranoiaetep

Reputation: 6637

Assuming you meant to display 0.123456e+13 as 1234560000000, not 0.123456, then you can use Qt::fixed(just like how you would use std::fixed):

qDebug() << Qt::fixed << d;

Upvotes: 2

Related Questions