Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Using decimal point separator on french OS

    QML and Qt Quick
    2
    2
    236
    Loading More Posts
    • 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
      Bert59 last edited by

      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 Reply Quote 0
      • S
        SimonSchroeder last edited by

        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 Reply Quote 2
        • First post
          Last post