Search code examples
pythonqt-designerqspinboxqradiobutton

Deactivate a spinbox in Qt Designer


Is it possible to deactivate a spinbox if a radiobutton is chosen? I've tried several things, but either the spinbox is deactived all the time or it wont deactivate at all.


Solution

  • I have no idea what you have been doing (perhaps you should mention what exactly instead of writing "tried several things" ;)) but yes, you can. In the slot-signal view select the radiobutton and drag a connection to the spinbox. For the signal emitted by the radiobutton choose toggled(bool). For the slot in the spinbox you need to check the Show signals and slots inherited from QWidget first (at the bottom of the connection dialog) in order to display all possible slots and then select either setDisabled(bool) or setEnabled(bool).