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. Action still available in disabled menu via short cuts
Forum Updated to NodeBB v4.3 + New Features

Action still available in disabled menu via short cuts

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.2k Views 2 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.
  • SikarjanS Offline
    SikarjanS Offline
    Sikarjan
    wrote on last edited by
    #1

    Hi,

    I noticed that my actions in my QMenu are still available via the short cut even if the menu the actions are located in is disabled.

    Menu:
    File Edit Insert
    -quit -find -image

    So if set Insert to disabled I can access image via its short cut.

    My expectation would have been that if Insert is disabled all actions within Insert would be disabled as well. Is this not linked or is there a special setting I did not see to lock the children enable to the parent enable?

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

      Usually you disable the actions directly. Disabling a menu only disables access to it from a parent menu or a button, not to the actions inside it.
      An action can be added to many menus, toolbars, widgets etc. at the same time. Disabling any of them should not disable the action.

      1 Reply Last reply
      3
      • SikarjanS Offline
        SikarjanS Offline
        Sikarjan
        wrote on last edited by
        #3

        I am not sure if this really makes sense. If I disable a menu I do it for a reason. I don't want the user to have access to the actions. Actually I cannot think of a situation where I want to disable the menu but not the functionality...

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

          If you want to disable functionality disable the functionality (action).Menu is just a container. If you have the same action in a menu and on a toolbar and you want to disable it you disable the action, not the menu.
          What actually rarely makes sense is disabling a menu.

          1 Reply Last reply
          2
          • SikarjanS Offline
            SikarjanS Offline
            Sikarjan
            wrote on last edited by
            #5

            My menu Insert is only valid if there is a file opened with the app. As long as no file is opened I cannot insert something. You can find this kind of behavior in many programs e.g. open office.

            My hope was that disabling the menu would trigger a disable for all actions as well so that I do not have to do it manually.

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

              Right, but, as I said - an action can be put in many containers simultaneously. It would be weird if disabling it disabled all the others so it doesn't do that.
              If you need that - quite easy. Just disable/enable the actions in the menu's changeEvent when the event is QEvent::EnabledChange.

              1 Reply Last reply
              2

              • Login

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