Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [SOLVED] QMenu shortcut to menu NOT action

    General and Desktop
    3
    5
    1566
    Loading More Posts
    • 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
      kyuzo555-hu last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • D
          danieltm64 last edited by

          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 Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • K
              kyuzo555-hu last edited by

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

              Kyuzo Makabe, LIVE FOR LIFE

              1 Reply Last reply Reply Quote 0
              • First post
                Last post