title: How to add submenu in Qt
body: <p>How do I add a submenu from the menu below? I need a submenu to open, say, after clicking </p>
  
  <pre><code>"A-&gt;Setup"
  </code></pre>
  
  <p>I want a submenu to be opened to the side of the main menu. </p>
  
  <pre><code>   void MyMenu::cppSlot()
          {
              QMenu *xmenu = new QMenu;
              xmenu-&gt;addMenu("A -&gt; Setup");
              xmenu-&gt;addMenu("B -&gt; Setup");
              xmenu-&gt;addMenu("C -&gt; Setup");
              xmenu-&gt;addMenu("D -&gt; Setup");
              xmenu-&gt;addMenu("E -&gt; Setup");
              //Change font and width
              xmenu-&gt;setFont(QFont ("Courier", 10));
              xmenu-&gt;setFixedWidth(250);
              //Colour setting
              xmenu-&gt;setAutoFillBackground(true);
              /*QPalette palette=xmenu-&gt;palette();
              palette.setColor(QPalette::Window, Qt::black);
              palette.setColor(QPalette::Window, Qt::text);
              palette.color(green)
              xmenu-&gt;setPalette(palette);*/
  
              // Align the menu coordinates
             // xmenu-&gt;
              xmenu-&gt;move(900,300);
  
              xmenu-&gt;show();
  
  
          }
  </code></pre>