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/tests/QtWidgets/qpushbutton_test.py | |
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/tests/QtWidgets/qpushbutton_test.py')
-rw-r--r-- | sources/pyside6/tests/QtWidgets/qpushbutton_test.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py index 3b23e1b9c..859202bb4 100644 --- a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py +++ b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py @@ -37,7 +37,7 @@ init_test_paths(False) from helper.usesqapplication import UsesQApplication from PySide6.QtWidgets import QPushButton, QMenu, QWidget -from PySide6.QtCore import QTimer +from PySide6.QtCore import QTimer, Qt class MyWidget(QWidget): @@ -67,6 +67,7 @@ class QPushButtonTest(UsesQApplication): def testBoolinSignal(self): b = QPushButton() b.setCheckable(True) + b.setShortcut(Qt.Key_A) self._clicked = False b.toggled[bool].connect(self.buttonCb) b.toggle() |