[QGIS-Developer] capturing kep press event in eventFilter

Catania, Luke A ERDC-RDE-GRL-VA CIV Luke.A.Catania at erdc.dren.mil
Tue Nov 12 18:07:30 PST 2024


Trying to capture key combination ctrl+u in my event filter on the map canvas.  I have it checking for mouse events and those work fine, but I never get a key event when pressing any key.

def eventFilter(self, source, event)
     if event.type() == event.KeyPress:
            self._log_msg("Other Key Event")
            if event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_U:
                self._log_msg("Key Event: Ctrl+U")

Luke Catania
US Army ERDC-GRL
JCMS Site Planning Developer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20241113/d4958d48/attachment.htm>


More information about the QGIS-Developer mailing list