QString arg() fixed number of decimal places
Solved
General and Desktop
-
I'm formatting a QString with several numbers using the "%1 %2 %3" format. One of the numbers is a double and I need to print it as a number with a fixed number of decimal places. I looked at the docs for QString and the only function that takes double as input seems to return scientific notation, which I don't want. I just want to take a double that might be 59.939999991 and return 59.94
Does anyone know how to do this?
Previously this was an MFC string that was using Format, which uses the same syntax as sprintf. So I just used %0.3f. Just trying to get the same result in Qt.