Re: how to set double precision
My double is 00.0 format. when I set it to QLCDNumber .display(double)
it automatically removes the precisions and displays 0
02.0 -> as 2.0
0.0 -> 0
20.0 -> 20
and so on. How can I force it keep it's format?
Added after 9 minutes:
Quote:
Originally Posted by
saman_artorious
My double is 00.0 format. when I set it to QLCDNumber .display(double)
it automatically removes the precisions and displays 0
02.0 -> as 2.0
0.0 -> 0
20.0 -> 20
and so on. How can I force it keep it's format?
I did this:
QString str = QString::number(f, 'f', 1);
now, how can I padleft the float? so that when I enter 02.0 it shows it and not 2.0? does qt support it?
Re: how to set double precision
Read about QString::rightJustified. And for the future: read the documentation, it does not hurt.
Re: how to set double precision
Quote:
Originally Posted by
Lesiok
result is not as expected. had to do this to get the expected result:
Code:
if(str.length() == 3)
str.insert(0, '0');
Re: how to set double precision
Code:
QString(%1
).
arg(f,
5,
'f',
1,
'0');
or similar. RightJustified() would also work.
Re: how to set double precision
Quote:
it automatically removes the precisions and displays 0
02.0 -> as 2.0
A leading zero has nothing to do with precision.