-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
PR: Make QAction.setShortcut
and setShortcuts
accept many types
#461
Conversation
Test `QMenu.addAction` with a shortcut of `Qt.Key` type as well. The argument type causes the following error on `PySide2`: ```plaintext TypeError: 'PySide2.QtWidgets.QAction.setShortcut' called with wrong argument types: PySide2.QtWidgets.QAction.setShortcut(Key) Supported signatures: PySide2.QtWidgets.QAction.setShortcut(PySide2.QtGui.QKeySequence) ```
Fix the omission of `Qt.Key` check. Fix a crash when `QAction.setShortcuts` gets a single shortcut. Add tests for the cases. Refactor a little.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
QMenu.addAction
with various shortcut typesQAction.setShortcut
and setShortcuts
accept many types
Some 6.3.2 builds still seem to lack the flexibility.
As the PR clearly conflicts with #460, you may cherry-pick the changes to that PR or compose a new PR from scratch. I don't really care as long as it leads to the QtPy improvement. |
Thanks for the work here @StSav012 ! I think we could merge first this one since it improves the tests, does some refactoring already and most importantly fixes a crash, After that, then we will be able to reassess checking for ways to simplify the related code as #460 tries to do. What do you think @ccordoba12 @CAM-Gerlach ? |
QAction.setShortcut
and setShortcuts
accept many typesQAction.setShortcut
and setShortcuts
accept many types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @StSav012 for your work on this!
…nt as suggested by @ccordoba12 The test is expected to fail on Qt6 >= 6.5. The earlier versions of PyQt/PySide are patched against the fail, so don't test them.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @StSav012 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now, thanks @StSav012!
Test
QMenu.addAction
with a shortcut ofQt.Key
type as well. The argument type causes the following error onPySide2
:This is a direct follow-up to #460.