Is there a slot for enabling/disabling a widget?

  • In the QtDesigner, I have a checkbox that when clicked I would like to enable two dependent widgets (two LineTexts). It seems I can wire the checkbox's clicked signal to those line text widgets, but they don't have a slot for enabling/disabling. How can I achieve this within QtDesigner and without having to write additional code?

  • ;-)

    Yes, there are slots exist for enabling/disabling a widget. You can find them in the manual of QWidget.

    And you can connect the signal "clicked(bool)" instead of "clicked()" to them under Qt Designer.


  • Which slot? clciked(bool) signal have 4 slot: clear(), selectAll(), stepDown() and stepUp(), all of them can't enable widget.

  • QWidget and all its sub-classes have following two slots:

    setDisabled((bool disable))
    setEnabled((bool enable))

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.