diff options
| author | Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> | 2019-01-11 10:13:14 +0100 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-06-18 15:28:28 +0200 |
| commit | a45ee7a68e3fbcf99eb31e8a395779cc0a9f3540 (patch) | |
| tree | df3bde78213e01af6037a54e7ac553b61e302f18 /sources/pyside6/PySide6/glue/qtgui.cpp | |
| parent | fd3dbb4678526535bb3e50d39dd69d590304890b (diff) | |
PySide6: Add QKey support for the setShortcut method
When this method is used in Qt/C++, the argument gets internally cast
to a QKeyCombination if it is a QKey, but in Python land this is not
automatically covered.
A workaround was for the users to manually cast the QKey, but this
adds an extra step to achieve the same.
This patch adds a new method to QAction and QAbstractButton to use
setShortcut with a QKey as an argument.
Pick-to: 6.1
Change-Id: I9e9ebe16a65cb5aeb26a367faecbbbd414d80e03
Fixes: PYSIDE-907
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtgui.cpp')
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtgui.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp index ef5caa545..6b30952d2 100644 --- a/sources/pyside6/PySide6/glue/qtgui.cpp +++ b/sources/pyside6/PySide6/glue/qtgui.cpp @@ -557,6 +557,10 @@ WId id = %1; %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval); // @snippet qwindow-fromWinId +// @snippet set-qtkey-shortcut +%CPPSELF.%FUNCTION_NAME(QKeyCombination(%1)); +// @snippet set-qtkey-shortcut + // @snippet qshortcut-1 %0 = new %TYPE(%1, %2); // @snippet qshortcut-1 |
