I am converting a code from PyQt4 to PyQt5 I encounter two difficulties, first that a signal dictionary is created with the name of the signal and the signal
MY_SIGNALS = {
'clicked': SIGNAL ('clicked'),
'currentIndexChanged': SIGNAL ('currentIndexChanged')
...
}
Second, in a function I receive a widget and a signal name in such a way that
def connect_actions (received_action, my_control):
...
connect (my_control, MY_SIGNALS [received_action], function_exec)
One solution is to check the received string and the widget
if my_control is QtWidgets.QPushButton:
if received_action is "clicked":
my_pushbutton.clicked.connect (function_exec)
but there are dozens of widgets and tokens, is there a way to adapt the code in such a way to assign a token by name like in PyQt4?
How can I adapt this code?