Preventing QLocale::toString(double) from displaying number in scientific notation?
-
I'm using QLocale::toString(double) to display numbers with commas (e.g., display 1000000 as 1,000,000). The issue I'm having is that if the number would overflow the widget it's displayed in it's displayed using scientific notation.
Is there a way to prevent this?
-
Yes it's in the docs: http://doc.qt.io/qt-5/qlocale.html#toString-6
QLocale::toString(double,'f') -
I previously tried the 'f' flag but if I enter 1000000 I wind up with 102.
I think it might be easier to just use toCurrencyString() and strip the leading '$'.
-
I previously tried the 'f' flag but if I enter 1000000 I wind up with 102.
I think it might be easier to just use toCurrencyString() and strip the leading '$'.
@Qt_User72653 said in Preventing QLocale::toString(double) from displaying number in scientific notation?:
but if I enter 1000000
1000000is an integer literal in C++QLocale::toString(1000000.0,'f')should work