Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to direct key presses to QOpenGLWindow in 5.6?
Forum Update on Monday, May 27th 2025

How to direct key presses to QOpenGLWindow in 5.6?

Scheduled Pinned Locked Moved Solved General and Desktop
qopenglwindowfocusqt5.6
2 Posts 1 Posters 1.4k Views
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    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
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved