I have a very basic question: how can I enforce the use of points in floating-point numbers instead of a comma (I have a french version of my OS) in Qt?
Other question :is it possible to display numbers with space for thousands separators?
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 of the options as in the “C” locale, you can simply do
Regarding your second question: Qt does not support custom locales, but you can try setting the number options to, say, Hungary’s locale (it should produce 1234 and 12 345.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
Answered By – Oleg2718281828
Answer Checked By – Robin (BugsFixing Admin)