PR: Make QAction.setShortcut and setShortcuts accept many types#461
Merged
ccordoba12 merged 16 commits intospyder-ide:masterfrom Nov 9, 2023
Merged
PR: Make QAction.setShortcut and setShortcuts accept many types#461ccordoba12 merged 16 commits intospyder-ide:masterfrom
QAction.setShortcut and setShortcuts accept many types#461ccordoba12 merged 16 commits intospyder-ide:masterfrom
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.
Contributor
Author
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. |
Member
|
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
ccordoba12
reviewed
Oct 24, 2023
Member
ccordoba12
left a comment
There was a problem hiding this comment.
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
dalthviz
approved these changes
Nov 7, 2023
ccordoba12
approved these changes
Nov 9, 2023
Member
ccordoba12
left a comment
There was a problem hiding this comment.
Looks good to me now, thanks @StSav012!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test
QMenu.addActionwith a shortcut ofQt.Keytype as well. The argument type causes the following error onPySide2:This is a direct follow-up to #460.