Python/PyQt/Qt QMenu QAction syntax

Viewed 1227

I have a syntax/understanding problem in an application using Python 3, PyQt5 and Qt5. I am unsure which of these is causing the problem.

I am charged with porting a GUI application which worked under Windows to Linux, with newer versions of libraries. I do not have access to the original running under Windows.

In several places I see:

menu = QMenu(self)
action = menu.addAction("Some string")
action.triggered[()].connect(self.handler)

I presume this used to work. I am porting to Python 3.5, PyQt 5.7 & Qt 5.7. I have reason to believe the code was written for earlier versions of each of these.

Executing it now generates a 'there is no matching overloaded signal' error, on the action.triggered[()] segment.

By guesswork and looking at a couple of examples I found somewhere, I have changed the last line to:

action.triggered.connect(self.handler)

and it seems to work now.

Could someone explain what the original triggered[()] syntax meant/worked, and which "product" the evident change was in --- it would be nice to be able to read about where this got changed? Is my replacement by simply triggered correct/same behaviour?

1 Answers
Related