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. Setting "hot keys" (or whatever they are called) for items in menus
QtWS25 Last Chance

Setting "hot keys" (or whatever they are called) for items in menus

Scheduled Pinned Locked Moved General and Desktop
shortcutsmenu
6 Posts 2 Posters 1.9k Views
  • 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.
  • J Offline
    J Offline
    joeydonovan4
    wrote on last edited by
    #1

    How do you set the shortcuts for opening menus and submenus? I know there is setShortcut in QAction, but I am referring to the underlining of a specific character, so when that character is pressed while the parent menu is open, the submenu will open. (e.g.) "Print" is a submenu in the file menu, and the "P" character needs to be underlined so that when it is pressed, the print dispatch will trigger. I know that putting '&' before the specified character usually notifies the program which character should be the "hot key". Just wondering if there is any specific way to do that with Qt.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      It's like you said: put "&" in front of the character you want to act as an accelerator.

      J 1 Reply Last reply
      0
      • Chris KawaC Chris Kawa

        It's like you said: put "&" in front of the character you want to act as an accelerator.

        J Offline
        J Offline
        joeydonovan4
        wrote on last edited by
        #3

        @Chris-Kawa The accelerators are working, but the line that usually shows up below the accelerator key is not there.

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It should show up (only) when you navigate to menus via keyboard i.e. hold "alt".

          J 1 Reply Last reply
          0
          • Chris KawaC Chris Kawa

            It should show up (only) when you navigate to menus via keyboard i.e. hold "alt".

            J Offline
            J Offline
            joeydonovan4
            wrote on last edited by
            #5

            @Chris-Kawa Is there a way to make them always visible? Seems unreasonable to ask the user of the app to have to press the alt key to see them beforehand.

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              It's not Qt specific and that's how Windows worked from the time it was invented. The accelerators are keyboard navigation aid and they are not shown unless you use keyboard.

              1 Reply Last reply
              0

              • Login

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