How to direct key presses to QOpenGLWindow in 5.6?
-
I converted my application from Qt 5.3 to 5.6. Previously I used to use QGLWidget and now upgraded to QOpenGLWindow contained in a QWidget. I would like my window to handle some key press events. QOpenGLWindow does have protected methods to handle the events. However, as opposed to the old QGLWidget, it does not have setFocus() method and my handlers are not being called. What is the remedy? Even when I attempted to resort to setting focus to the owning container and manually piping events to QOpenGLWindow, events still were not coming.
Is there a different way to direct keyboard input to QOpenGLWindow?
-
I managed to solve the problem by adding eventFilter to my subclass of QOpenGLWindow and then installing event filter for the owning container (and some of its parents).