PDA

View Full Version : QGLWidget - keyboard arrows and mouse zoom intercept



enthalio1
23rd July 2012, 20:17
Hi all, I have a QGLWidget with a scene rendered on it and I'd like to intercept keyboard arrows and the mouse wheel to zoom/move into it.

The problem is: I need to take its focus into account because I also have two QTextEdit widgets in the same window. I need something like "if the openGL widget is clicked, activate focus for it and intercept keyboard and mouse (also grabKeyboard() if I'm sure the focus is on the openGL one), if it's focused out, release the hooks"

I tried with an event filter for focus on the openGL widget but it didn't work, I followed this example: http://doc.trolltech.com/3.3/qobject.html#installEventFilter

Any idea how to do this?

high_flyer
24th July 2012, 14:30
I tried with an event filter for focus on the openGL widget but it didn't work,
Show your code.
You can also subclass QGLWidget and overload the corresponding event handlers.
But and event filter should work as well.