Setting "hot keys" (or whatever they are called) for items in menus
-
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.
-
It's like you said: put "&" in front of the character you want to act as an accelerator.
-
@Chris-Kawa The accelerators are working, but the line that usually shows up below the accelerator key is not there.
-
It should show up (only) when you navigate to menus via keyboard i.e. hold "alt".
-
@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.
-
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.