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. Remove QMenu from QPushButton
QtWS25 Last Chance

Remove QMenu from QPushButton

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.2k 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
    AgmMetalDev
    wrote on last edited by
    #1

    To create a popup menu and then assign it to a QPushButton, there's

    @QPushButton::setMenu(QMenu *menu)@

    but if once you have assigned the menu to the button, you want to remove it, how could you do this?

    1 Reply Last reply
    0
    • T3STYT Offline
      T3STYT Offline
      T3STY
      wrote on last edited by
      #2

      Doesn't the call to setMenu() with 0 or NULL parameter do the trick?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mehrdadsilver
        wrote on last edited by
        #3

        Or if you want only hide menu items and show again later use this:

        pushButton->menu()->setVisible(false);

        Mehrdad Abdolghafari, Be silver

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AgmMetalDev
          wrote on last edited by
          #4

          Yes, setMenu(NULL) works, thanks

          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