Important: Please read the Qt Code of Conduct -

QSpinBox without QLineEdit (only arrows)

  • Hello,

    Is it possible to hide/remove the QLineEdit that is shipped with a QSpinBox so that we are left only with the up/down arrows or plus/minus buttons?

    It seems possible to make the QLineEdit read only (via QAbstractSpinBox) but not to remove it.


  • in gui programming, SpinBox is a control that has up/down key with textbox and you can change the value of textbox with keys.
    but if you want to do this,it's better to design your own's easy.

  • Hi Abbas,

    Thanks for your reply. The advantage would be to not recode all the behaviour of the widget. I would then just have to connect my slots to the Qt widget's signals.

    In fact I tried to do my own replacement with just two buttons (QPushButton or QToolButton) and then set a "plus" and "minus" icon/background image for these buttons but I'm experiencing problems with the clickable area:

  • OK . I'm going to answer it soon. :)

Log in to reply