Force, not comma for floating point in Qt
1 answer
Try the following:
QLocale loc = QLocale::system(); // current locale
loc.setNumberOptions(QLocale::c().numberOptions()); // borrow number options from the "C" locale
QLocale::setDefault(loc); // set as default
If you want all the options as in the "C" locale, you can simply do
QLocale::setDefault(QLocale::c());
Regarding your second question: Qt does not support custom locales, but you can try setting the number parameters in, say, Hungary (it should produce 1234 and 12345.67 - I haven't tried it myself)
QLocale loc = QLocale::system(); // current locale
QLocale hungary(QLocale::Hungarian);
loc.setNumberOptions(hungary.numberOptions()); // borrow number options from the Hungarian locale
QLocale::setDefault(loc); // set as default
+4
source to share