Problem with getting a keyPressEvent for arrow keys
-
I have an application with a QGraphicsView. When I use the arrow keys, things scroll as I expect.
I also have a QObject on the screen. When I hover over the QObject, I pop up a QDialog.
While the QDialog is displayed, the arrow keys no longer work. The other keys (letter and number keys) still work fine. Neither the keyPressEvent method or the main event method are called for the arrow keys, but they are both called for letter keys.
I've tried overriding the keyPressEvent and the event methods for every class I can think of, for the QObject, for the QDialog, for QGraphicsView, for QGraphicsScene, and none of those get called for arrow keys when that hover dialog is up, but the right ones are called when I press a letter key.
I even set the focus policy to strong focus as some online have suggested. It didn't change the behavior.
I think I've run out of things to try. Anyone have any suggestions?
Windows 11. Qt 5.15
-
Hi,
The best thing to do would be to create a minimal compilable reproducer so that people can check what might be going on.
-
Hi,
The best thing to do would be to create a minimal compilable reproducer so that people can check what might be going on.
@SGaist I would do that if I thought it was possible.
A debugging Qt would help, but we aren't set up for that here.
Does Qt have any internal logging that could be turned on in a release build that might help? I'd love to see who is swallowing the arrow keys.
-
Are you using a custom Qt build ?
One thing you can do is check the Qt Logging Category.
There are multiple used in Qt's own code.