Numpad shortcuts do not work anymore
hgn <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
Hello, for quite some time (maybe over a year?) now numpad shortcuts are broken. In worked in the past. These are shortcuts for the numpad keys, like the numbers, when the numpad is active (LED on keyboard is lit) Tested on Python 3.7.3, PyQt5 5.12.1, 5.12.2 I have attached a python file that will enable you to see the problem. Run it from the terminal. +hgn P.S. I posted this to the Qt bugtracker when I first discovered it but they refused to even look at the bug because it was Python code. I am not able to write this example in C++. _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt
keypadmodifier-bug.py
(text/x-python, 980 B)
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
qtApp = QtWidgets.QApplication(sys.argv)
widget = QtWidgets.QWidget()
print ("In the empty Qt window: Press Ctrl+1 to see 'Foo Bar', press Numpad 1 (with numpad LED active) to see 'Hello World'. or not, because there is a bug")
########Relevant Code########
numpadAction = QtWidgets.QAction("Numpad")
widget.addAction(numpadAction) #no actions without a widget
numpadAction.setShortcut(QtGui.QKeySequence(QtCore.Qt.KeypadModifier+QtCore.Qt.Key_1)) #Numpad 1. Needs numpad LED activated.
numpadAction.triggered.connect(lambda: print ("Hello World"))
ctrlAction = QtWidgets.QAction("Control")
widget.addAction(ctrlAction) #no actions without a widget
ctrlAction.setShortcut(QtGui.QKeySequence(QtCore.Qt.ControlModifier+QtCore.Qt.Key_1)) #Ctrl+1
ctrlAction.triggered.connect(lambda: print ("Foo Bar"))
########Relevant Code End########
widget.show()
sys.exit(qtApp.exec_())