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. Catch all keyboard input?
Forum Updated to NodeBB v4.3 + New Features

Catch all keyboard input?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 317 Views 1 Watching
  • 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.
  • D Offline
    D Offline
    Dan203
    wrote on last edited by
    #1

    I have an app I'm looking to port from MFC to Qt Widgets. One of the main features of the app is it has a completely customizable keyboard shortcut system. The way we do this now is we use the PreTranslateMessage function to process all keyboard input to the app and then compare it to the user list. If it exists we execute the attached function and stop further processing. If it doesn’t we pass it along for default processing. Is there an equivalent way to handle this in Qt? There are no input controls in the UI, but there is a list control (QTableWidget in Qt) and a bunch of buttons, so I need something that will capture the input regardless of which control has focus.

    JonBJ 1 Reply Last reply
    0
    • D Dan203

      I have an app I'm looking to port from MFC to Qt Widgets. One of the main features of the app is it has a completely customizable keyboard shortcut system. The way we do this now is we use the PreTranslateMessage function to process all keyboard input to the app and then compare it to the user list. If it exists we execute the attached function and stop further processing. If it doesn’t we pass it along for default processing. Is there an equivalent way to handle this in Qt? There are no input controls in the UI, but there is a list control (QTableWidget in Qt) and a bunch of buttons, so I need something that will capture the input regardless of which control has focus.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Dan203
      Before going further, have you looked at QShortcut Class? Note the possibilities from enum Qt::ShortcutContext.

      Otherwise you can use a global eventFilter() which might be more like PreTranslateMessage?

      1 Reply Last reply
      1

      • Login

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