[PyQt] Catch a F key press in a QLineEdit

Starglider Developer starglider.dev at gmail.com
Sun Nov 18 21:52:35 GMT 2018


Hi,
I need to check if a function key F1, F2... F12 is pressed when the focus
is in a QLineEdit,
so far I can do that on the main widget overloading the keyPressEvent:

def keyPressEvent(self, e):
    if e.key() == Qt.Key_F12:
        self.close()


but didn't find a way of get it from a widget other than the main widget.

Thank you in advance.
Regards,
Jorge
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20181118/6486c011/attachment.html>


More information about the PyQt mailing list