Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved How to direct key presses to QOpenGLWindow in 5.6?

    General and Desktop
    qopenglwindow focus qt5.6
    1
    2
    1162
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User last edited by A Former User

      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?

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User last edited by

        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).

        1 Reply Last reply Reply Quote 0
        • First post
          Last post