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. Format text input in TextField
Forum Update on Monday, May 27th 2025

Format text input in TextField

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 337 Views
  • 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.
  • A Offline
    A Offline
    Adso4
    wrote on 12 Aug 2020, 15:57 last edited by
    #1

    I have a textField where the user can input an integer value (up to 999999). I achieve this with an IntValidator. So, no other characters are allowed.

    What I need is that the displayed text must be formatted. For example:

    1 --> 1 m
    2 --> 2 m
    1000 --> 1.000 m
    12000 --> 12.000 m

    How can achieve this?

    A 1 Reply Last reply 12 Aug 2020, 20:41
    0
    • A Adso4
      12 Aug 2020, 15:57

      I have a textField where the user can input an integer value (up to 999999). I achieve this with an IntValidator. So, no other characters are allowed.

      What I need is that the displayed text must be formatted. For example:

      1 --> 1 m
      2 --> 2 m
      1000 --> 1.000 m
      12000 --> 12.000 m

      How can achieve this?

      A Offline
      A Offline
      Allon
      wrote on 12 Aug 2020, 20:41 last edited by
      #2

      @Adso4 Hi,
      Did not run it myself but did you see this web page?
      https://stackoverflow.com/questions/19307271/how-to-format-clean-numbers-so-1000-appear-as-1-000-00
      Regards,
      Emmanuel

      1 Reply Last reply
      0

      1/2

      12 Aug 2020, 15:57

      • Login

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