disable editing in QSpinbox but enable arrows

roy.me

I have a QSpinBox in which I want to enable the arrows (for up and down values) but disable inserting data by the user. I've tried using this:

QtGui.QSpinBox.setReadOnly(True)

But it doesn't work. All is disabled and the arrows are 'stuck'.

ekhumoro

If you set the spin-box readonly, it will disable eveything. Instead, just set the line-edit readonly, and then buttons will still work:

spinbox.lineEdit().setReadOnly(True)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related