Today, we’ll look at a quick tip to show you how to use the Qt Creator Signals and Slots editor to add a checkbox that disables/enables widgets on a form. Of course, you could easily do this in code, but this is one of those things that I simply prefer to use the form editor for, since it creates a lot of redundant code in your UI class.
The logic behind it is simple. You have a checkbox toggled(bool) signal connected up to your widget with the setEnabled(bool) slot. First, go to the editor and change it to signals and slots mode. Drag a connection from the checkbox/toggle to the widget(s) you would like to have toggled. When they connect, make sure you have inherited signals/slots checked! You will not get the setEnabled(bool) otherwise.
And all this without cluttering your UI class! Below you can see it in action. I would encourage you to play around with some of the other slots, namely setHidden(bool), which might give you a result you are looking for.
Hope you learned something! Keep on coding!