Search code examples
qtuser-interfacepyqtqt-designersignals-slots

Signals and Slots Editing Buttons Are Disabled (Qt Designer 4.8)


I want to add custom slots to my design via Qt Designer (4.8), but editing buttons on "Configure Connection" window are disabled. How can I solve it?

signal and slot buttons are disabled on Qt Designer


Solution

  • You can only add custom signals/slots to subclasses of Qt classes.

    As a demonstration of this, make a connection between pushButton and the top-level widget. When the connection dialog is shown, you will see that the right-hand edit button is now enabled. This is because the top-level widget will usually be a subclass of QWidget, QMainWindow, or QDialog that is defined by the application.

    To add custom signals/slots to child widgets, you would need to use widget promotion, so that you can specify a subclass that will be supplied by your application. See this answer for how to promote widgets in PyQt.