title: Qtoolbar toggle show hide on Qmenu
body: <p>How to add slot to toggle show and hide the toolbar in qmenu? This my code:</p>
  
  <pre><code>#include "mainwindow.h"
  
  MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent)
  {
      setMinimumSize(800, 600);
  
      CreateAct();
      CreateMenus();
      createToolBars();
  }
  
  void MainWindow::CreateAct()
  {
      undoAct = new QAction(QIcon::fromTheme("edit-undo", QIcon(":/images/undo.png")), tr("&amp;Undo"), this);
      redoAct = new QAction(QIcon::fromTheme("edit-redo", QIcon(":/images/redo.png")), tr("&amp;Redo"), this);
      cutAct = new QAction(QIcon::fromTheme("edit-cut", QIcon(":/images/cut.png")), tr("Cu&amp;t"), this);
      copyAct = new QAction(QIcon::fromTheme("edit-copy", QIcon(":/images/copy.png")), tr("&amp;Copy"), this);
      pasteAct = new QAction(QIcon::fromTheme("edit-paste", QIcon(":/images/paste.png")), tr("&amp;Paste"), this);
  
      editToolBarAct = new QAction(tr("Show edit toolbar"), this);
      editToolBarAct-&gt;setCheckable(true);
      editToolBarAct-&gt;setChecked(true);
  //    connect(editToolBarAct, SIGNAL(toggled(bool)), editToolBar, SLOT());
  
      fileToolBarAct = new QAction(tr("Show file toolbar"), this);
      fileToolBarAct-&gt;setCheckable(true);
      fileToolBarAct-&gt;setChecked(true);
  //    connect(fileToolBarAct, SIGNAL(toggled(bool)), fileToolBar, SLOT());
  }
  
  void MainWindow::CreateMenus()
  {
      windowMenu = menuBar()-&gt;addMenu(tr("&amp;Window"));
      windowMenu-&gt;addAction(fileToolBarAct);
      windowMenu-&gt;addAction(editToolBarAct);
  }
  
  void MainWindow::createToolBars()
  {
      fileToolBar = addToolBar("file");
      fileToolBar-&gt;addAction(undoAct);
      fileToolBar-&gt;addAction(redoAct);
      fileToolBar-&gt;toggleViewAction();
      fileToolBar-&gt;setAllowedAreas(Qt::TopToolBarArea | Qt::LeftToolBarArea);
  
      editToolBar = addToolBar(tr("Edit"));
      editToolBar-&gt;addAction(cutAct);
      editToolBar-&gt;addAction(copyAct);
      editToolBar-&gt;addAction(pasteAct);
      editToolBar-&gt;setAllowedAreas(Qt::TopToolBarArea | Qt::LeftToolBarArea);
  }
  
  MainWindow::~MainWindow() {}
  </code></pre>
  
  <p>I am know using <a href="http://qt-project.org/doc/qt-5/qtoolbar.html#toggleViewAction" rel="nofollow">toggleViewAction</a>, but how to use that code (I am really new in qt programming), can you give me sample code? I've tried googling, but did not find examples of its use.</p>