Results 1 to 8 of 8

Thread: QGLWidget, keyPressEvent does not work

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2009
    Posts
    132
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    67
    Thanked 6 Times in 5 Posts

    Default Re: QGLWidget, keyPressEvent does not work

    OK. It seems now it works.

    I read this on docs:

    "The policy is Qt::TabFocus if the widget accepts keyboard focus by tabbing, Qt::ClickFocus if the widget accepts focus by clicking, Qt::StrongFocus if it accepts both, and Qt::NoFocus (the default) if it does not accept focus at all."

    And

    "You must enable keyboard focus for a widget if it processes keyboard events. This is normally done from the widget's constructor. For instance, the QLineEdit constructor calls setFocusPolicy(Qt::StrongFocus)."

    After adding setFocusPolicy(Qt::StrongFocus) in my OGL component, it works. It seemed to be focus was disabled.

    Thanks.

  2. The following user says thank you to ricardo for this useful post:

    shenakan (28th September 2009)

Similar Threads

  1. QGraphicsItem keyPressEvent oddness
    By jonks in forum Qt Programming
    Replies: 5
    Last Post: 3rd June 2009, 15:08
  2. Replies: 1
    Last Post: 23rd April 2009, 09:05
  3. Replies: 1
    Last Post: 21st November 2008, 07:00
  4. Replies: 4
    Last Post: 7th May 2008, 00:01
  5. QGLWidget on another QGLWiget
    By showhand in forum Qt Programming
    Replies: 1
    Last Post: 23rd October 2006, 09:59

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
  •  
Qt is a trademark of The Qt Company.