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. Disable children (shortcuts) of a qmenu
Forum Updated to NodeBB v4.3 + New Features

Disable children (shortcuts) of a qmenu

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 249 Views 1 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.
  • W Offline
    W Offline
    wakiki
    wrote on last edited by wakiki
    #1

    Disabling a QMenu does not disable its children QActions
    (at least in my case. maybe its because im using nested QAction's and QMenu's)
    The user could still open a QAction accidentally by pressing its active shortcut.
    I want to prevent this by disabling all children or at least those which have active shortcuts, if a QMenu is disabled.
    Whats the best approach to do this, if you dont have easy access between the QMenu and the single QAction to solve it with a single slot ?

    Should i just loop through all of children?
    Does findChildren() / children() give me nested child, which is not part of the first level children?

    edit: i found my solution here:
    https://askcodes.net/coding/how-to-iterate-through-a-menu-s-actions-in-qt-

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

      Hi,

      Are these actions associated only to the QMenu ?

      Can you provide a minimal compilable example that shows this behaviour ?

      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

      • Login

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