Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Format text input in TextField
Qt 6.12 LTS is out! See what's new in the release blog

Format text input in TextField

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 650 Views 1 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.
  • A Offline
    A Offline
    Adso4
    wrote on 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
    0
    • A Adso4

      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 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

      • Login

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