Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QMenu.add_action() got an unexpected keyword argument 'shortcut' #472

Open
ronpandolfi opened this issue Dec 22, 2023 · 3 comments
Open
Labels
Milestone

Comments

@ronpandolfi
Copy link

Since qtpy>=2.4, the shortcut= kwarg on QMenu.add_action() isn't working.

TypeError: add_action() got an unexpected keyword argument 'shortcut'

I notice that this method is now wrapped in a partial like this:

> qmenu.addAction
functools.partial(<bound method add_action of <PyQt5.QtWidgets.QMenu object at 0x00000158E93FBD90>>, old_add_action=<built-in function addAction>)

while in qtpy==2.3.0,

> qmenu.addaction
<function QMenu.addAction>

I haven't traced this further, but hopefully that's a start.

@dalthviz
Copy link
Member

Hi @ronpandolfi thank you for the feedback! Indeed we started wrapping the addAction method at some point to provide better compatibility between bindings. Could it be possible for you to check if installing QtPy from the latest master helps with the issue you are experiencing? Maybe this could be related with some fixes already merged that were done at #461 and that will be available when we release QtPy 2.4.2

Any other info is greatly appreciated, let us know!

@dalthviz dalthviz added this to the v2.4.2 milestone Dec 26, 2023
@ronpandolfi
Copy link
Author

@dalthviz The issue persists with the latest master branch (2.5.0.dev0). Also, I'm testing on windows with PyQt5==5.15.7 bindings.

@dalthviz
Copy link
Member

dalthviz commented Apr 11, 2024

Note: I think the issue here is that PyQt5 uses a kwarg for the shortcut while PySide2/6 and PyQt6 don't 🤔

Edit: Some links to check https://doc.qt.io/qt-5/qmenu-members.html#addAction https://www.riverbankcomputing.com/static/Docs/PyQt6/api/qtwidgets/qwidget.html#addAction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants