Qt World Summit: Register Today!

QSpinBox truncated text in Qt 5

  • I've got a QSpinBox in a toolbar. There's some prefix text and sizing is all default. Displayed text is truncated at both ends. If I turn off the buttons, display looks right for a single-digit value. (My maximum is 99, 2 digits.) I can force the width by adding the length of the text calculated from fontMetrics plus some extra for the buttons. It just worked in Qt 4. Was I just lucky that it worked in Qt 4, or is Qt 5 broken?

  • There are likely to be a few regressions in Qt5 as there are a lot of changes under the hood. I am not aware of any significant changes done to QSpinBox so my assumption is that this is caused by a style change. It would be great if you posted a proper bug report over at:


    Make sure to add a minimal example, which platform and perhaps which style you are using.

  • QTBUG-28863 has been created.

Log in to reply