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. Using decimal point separator on french OS
Forum Updated to NodeBB v4.3 + New Features

Using decimal point separator on french OS

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 478 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.
  • B Offline
    B Offline
    Bert59
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SimonSchroeder
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      2

      • Login

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