Important: Please read the Qt Code of Conduct -

Double Validator without thousand-separation

  • Hi guys,

    I want to use a TextInput with numeric validation (DoubleValidator).
    The Validator uses locale to interpret the input. The standard locales use thousand-separator ( "," in EN_US "." in DE_DE).
    Is the a way to disable thousand separation?


  • @themts Hi! You can use RegExpValidator if you need a custom validator.

  • Problem is that my app wouldn't be localized anymore.
    If my app is running on a EN_US system I want to have '.' as decimal separator. DE_DE uses ',' as decimal separator. I just want to prevent the thousand separator.
    Is there a create a custom Qt.locale() which is based on the systems locale?

  • Maybe setting the number options to QLocale::OmitGroupSeparator | QLocale::RejectGroupSeparator using void QLocale::setNumberOptions(NumberOptions options) could help.

Log in to reply