title: How do I hide a sub-menu in QMenu
body: <p>I have an application where I generate menu items, and I want to set the visibility of a particular sub-menu.</p>
  
  <p>I tried using <code>setVisibility(False)</code>, but this did not work.
  <code>setVisibility()</code> works for menu items, but not for sub-menus in QMenus.</p>
  
  <p>Have a look at the code snippet below:</p>
  
  <pre><code>import sys
  from PyQt4 import QtGui
  
  class Window(QtGui.QWidget):
      def __init__(self, parent=None):
          super(Window, self).__init__(parent)
          self.menu = QtGui.QMenu()
          self.actio1 = QtGui.QAction('One', self)
          self.actio2 = QtGui.QAction('Two', self)
          self.menu.addAction(self.actio1)
          self.menu.addAction(self.actio2)
          self.actio1.setVisible(False)
          self.submenu = QtGui.QMenu('submenu', self)
          self.submenu.addAction('sub one')
          self.submenu.addAction('sub two')
          self.menu.addMenu(self.submenu)        
          self.submenu2 = QtGui.QMenu('submenu 2', self)
          self.submenu2.addAction('sub 2 one')
          self.submenu2.addAction('sub 2 two')
          self.menu.addMenu(self.submenu2)        
          self.submenu2.setVisible(False)
          layout = QtGui.QHBoxLayout()
          layout.addWidget(self.menu)
          self.setLayout(layout)
  
  if __name__ == '__main__':
  
      app = QtGui.QApplication(sys.argv)
      w = Window()
      w.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>In the above example, I can hide the menu item named "One", but not the sub-menu named "submenu 2"</p>
  
  <p>Can anyone give me an idea...</p>