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. [SOLVED] QMenu shortcut to menu NOT action
QtWS25 Last Chance

[SOLVED] QMenu shortcut to menu NOT action

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.8k 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.
  • K Offline
    K Offline
    kyuzo555-hu
    wrote on last edited by
    #1

    Hello everybody,

    I would like to solve my issue and I hope you can help in this for me.
    I can set a shortcut to QActions but not for QMenus. I mean in the way of Qt Creator, e.g.: ALT+F for File menu.
    How can I implement this?

    Thank you for your time :)

    Kyuzo Makabe, LIVE FOR LIFE

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      IIRC, you can set the shortcut you want on the action return by "QMenu::actionMenu":http://doc.qt.io/qt-5/qmenu.html#menuAction

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        danieltm64
        wrote on last edited by
        #3

        When editing the text of the menu, write an ampersand just before the character you want to be associated with the menu. For example, if you have a 'File' entry in your main menu bar, just write '&File' as the menu's text, and the next time you run your application you will be able to press Alt+F for that menu. If you wrote 'Fil&e' as your menu's text, then you will have to press Alt+E for that menu.

        Daniel

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Err… I misread your post. danieltm64 is right. The full explanation can be found in "QMenuBar's documentation":http://doc.qt.io/qt-5/qmenubar.html#details

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kyuzo555-hu
            wrote on last edited by
            #5

            Really lot of thank you, guys:) It was to easy to believe :D

            Kyuzo Makabe, LIVE FOR LIFE

            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