Re: Shortcuts are broken. Qt or PyQts fault?
hgn <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
> Not without a short, complete test script that demonstrates the > problem. > > Phil I have attached a python file that will enable you to see the problem. Run it from the terminal. Press Ctrlr+1 to see "Foo Bar", press Numpad 1 (with numpad LED active) to see "Hello World". Tested with Python 3.7.3 and 5.12.1 thanks for your answer yours, hgn Am 02.05.2019 23:20 schrieb Phil Thompson: > On 02/05/2019 21:08, hgn wrote: >> Hello PyQt list, >> >> for a substantial amount of time and multiple releases keyboard >> shortcuts for actions, e.g. menu action, with the number pad don't >> work anymore. >> >> In talks with Qt (C++) developers they shifted the blame to PyQt. >> >> Can you confirm this? > _______________________________________________ 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_())