I have an action in the main menu of my application with keyboard shortuct set to "Del". It works fine, and pressing Del correctly triggers the action.

The problem is that I have one single widget in my app which should handle the "Del" press differently (actually this is a file brower, and pressing del there should delete selected files instead of performing main delete functionality of the app). Overloading the keyPressEvent for this browser and handling the del key press there doesn't give the desired result - in most cases the action is triggered, that is not right.

The deisred effect is that del pressed in the browser deletes files, and del pressed anywhere else fires the action. Btw, such behavior is shown by the textboxes, pressing del in the textbox correctly deletes the symbol under cursor instead of fiting the action.

As far as I understand, this should be somehow resolved by using event filters, but I'm not that proficient with them. Can someone help me out?

BTW, changing the action shortcut is not an option.

Thank you.