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. Howto remove QMenu from QMenu
Qt 6.11 is out! See what's new in the release blog

Howto remove QMenu from QMenu

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 4.4k 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.
  • A Offline
    A Offline
    Auke-Dirk
    wrote on last edited by
    #1

    Hi all,

    i've added a QMenu (addMenu) to a parent Qmenu, i'm however unable to figure out how to
    remove this submenu

    Qt 5.6.0

    auto submenu   = parentMenu->addMenu( "Foo" );
    

    i can remove an QAction,

    any idea?

    Regards Auke

    RatzzR 1 Reply Last reply
    0
    • A Auke-Dirk

      Hi all,

      i've added a QMenu (addMenu) to a parent Qmenu, i'm however unable to figure out how to
      remove this submenu

      Qt 5.6.0

      auto submenu   = parentMenu->addMenu( "Foo" );
      

      i can remove an QAction,

      any idea?

      Regards Auke

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by
      #2

      @Auke-Dirk
      First get the QAction for the submenu you want to delete and then use removeAction

      QAction *menuToBeRemoved = subMenu->menuAction();
      mainMenu->removeAction(menuToBeRemoved);

      --Alles ist gut.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Auke-Dirk
        wrote on last edited by
        #3

        Super thanx that did the trick

        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