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. Get rid of 'thousand separator' in SpinBox
Qt 6.11 is out! See what's new in the release blog

Get rid of 'thousand separator' in SpinBox

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 3 Posters 2.6k 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.
  • D Offline
    D Offline
    dasun
    wrote on last edited by
    #1

    Is there a way to get rid of 'thousand separator' (,) shown in SpinBox (Qt Quick Component).

    1 Reply Last reply
    0
    • D Offline
      D Offline
      djfongang
      wrote on last edited by
      #2

      Copying and pasting from somewhere else on the web.

      (Not sure if we are allowed to link)

      You could subclass QSpinBox and reimplement the textFromValue which is responsible for the display of the value to the spinbox widget. A possible implementation could be the following:

      @QString MySpinBox::textFromValue(int value)
      {
      return this->locale()->toString(value);
      }@

      Using locale is the best way since it will display the separator based on the user's settings.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dasun
        wrote on last edited by
        #3

        If i'm not getting you wrong, Your reply is only true for QWidgets, I'm asking about the Qt Quick component SpinBox not the QSpinBox.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          djfongang
          wrote on last edited by
          #4

          Oh, ok.

          sorry for SpinBox, it would be style modifications but I do not know how to do it.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dasun
            wrote on last edited by
            #5

            Yes, It should be possible by overriding with style component but there is no documentation about it.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jens
              wrote on last edited by
              #6

              I am pretty certain we don't have a way to format the value in the current SpinBox and the thousand separator is implicitly added based on your locale. You can certainly post a feature request for this on our bug tracker.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dasun
                wrote on last edited by
                #7

                Thanks Jens, Your replys always help me a lot!

                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