Results 1 to 2 of 2

Thread: QGLWidget - keyboard arrows and mouse zoom intercept

  1. #1
    Join Date
    Jul 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QGLWidget - keyboard arrows and mouse zoom intercept

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

    Any idea how to do this?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QGLWidget - keyboard arrows and mouse zoom intercept

    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 3
    Last Post: 10th October 2011, 17:55
  2. QGraphicsView - zoom out using the right mouse button
    By dbrmik in forum Qt Programming
    Replies: 1
    Last Post: 14th April 2009, 23:17
  3. QGLWidget with text - zoom in / zoom out
    By h123 in forum Qt Programming
    Replies: 1
    Last Post: 16th November 2008, 10:56
  4. How to intercept mouse events in a scene
    By markmuetz in forum Qt Programming
    Replies: 2
    Last Post: 22nd May 2008, 15:36
  5. keyboard left and right arrows in qt 3.3.5
    By rajaraob in forum Qt Programming
    Replies: 5
    Last Post: 22nd February 2007, 12:03

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.