Important: Please read the Qt Code of Conduct -

Using decimal point separator on french OS

  • Hi
    I have a TextInput component with the validator set to DoubleValidator.
    On my PC the decimal separator is the coma (,) but I need the point (.) as decimal separator independly in which country the application is running.
    How can I do that?
    Thank you

  • I have never tried it myself. However, QValidator has a method setLocale(). This sets how the input should be interpreted. Most likely you are looking for QLocale::C which only support the point and not the comma (at least as decimal separator). Though by default locales allow for group separators. So, you might want to get a copy of the C locale object and adjust the QLocale::NumberOptions accordingly.

    Let me know if this approach works.

Log in to reply