Results 1 to 9 of 9

Thread: How to catch "ENTER" with keyPress?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #9
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    2
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to catch "ENTER" with keyPress?

    Has anyone considered using the QShortcut class to handle intercepting keyboard shortcuts? I had a table widget that was "stealing" the enter and tab keys from me and I got around the problem by using QShortCut as follows:

    //Intercept the CTRL-TAB key from the table widget
    QShortcut* shortcutTabKey;
    shortcutTabKey = new QShortcut( QKeySequence( tr("Ctrl+TAB") ), m_tableWidget );
    connect( shortcutTabKey, SIGNAL( activated() ), this, SLOT( OnTableShortCutTabKey() ) );

    Hopefully this helps someone, as it seems easier than overriding QWidget::event.

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

    Siena (5th April 2013)

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.