Details
Description
I think this is a shiboken feature request. An example is:
a = QAction() a.setShortcut(Qt.Key_Back)
PySide6
Python 3.8 Qt 6.2.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 9.3.0) FIXME Subscripted generics cannot be used with class and instance checks Traceback (most recent call last): File "pyside907.py", line 25, in <module> a.setShortcut(Qt.Key_Back) TypeError: 'PySide6.QtGui.QAction.setShortcut' called with wrong argument types: PySide6.QtGui.QAction.setShortcut(Key) Supported signatures: PySide6.QtGui.QAction.setShortcut(Union[PySide6.QtGui.QKeySequence, PySide6.QtCore.QKeyCombination, PySide6.QtGui.QKeySequence.StandardKey, str, int])
PySide2
Python 3.8 Qt 5.15.4 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6)) Traceback (most recent call last): File "pyside907.py", line 25, in <module> a.setShortcut(Qt.Key_Back) TypeError: 'PySide2.QtWidgets.QAction.setShortcut' called with wrong argument types: PySide2.QtWidgets.QAction.setShortcut(Key) Supported signatures: PySide2.QtWidgets.QAction.setShortcut(PySide2.QtGui.QKeySequence)
In C++, the Key_Back is implicitly converted to a QKeySequence because the QKeySequence constructor takes a QKey as an argument. Interestingly:
>>> a.setShortcut(Qt.CTRL + Qt.Key_Plus)
is okay.
Attachments
For Gerrit Dashboard: PYSIDE-907 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
249722,5 | PySide6: Add QKey support for the setShortcut method | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
355541,2 | PySide6: Add QKey support for the setShortcut method | 6.1 | pyside/pyside-setup | Status: MERGED | +2 | 0 |