Intercepting Tab key press to manage focus switching manually

前端 未结 4 1793
一向
一向 2020-12-16 22:58

I want to intercept Tab key press in my main window to prevent Qt from switching focus. Here\'s what I\'ve tried so far:



        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 23:30

    You'll need to install an event filter on your main window in order to receive the events. You can use installEventFilter method for this. Another option is to override the keyPressEvent method to handle the key presses.

提交回复
热议问题