Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Double Validator without thousand-separation

Double Validator without thousand-separation

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 1.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    themts
    wrote on last edited by
    #1

    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?

    CU
    mts

    ? 1 Reply Last reply
    0
    • T themts

      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?

      CU
      mts

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        themts
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved