Qt World Summit: Submit your Presentation

Get rid of 'thousand separator' in SpinBox

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

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

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

  • Oh, ok.

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

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

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

  • Thanks Jens, Your replys always help me a lot!

Log in to reply