title: How to perform action on clicking a QMenu object only?
body: <p>Here's a snapshot of the GUI. I want to perform simple actions solely by clicking on <code>QMenu</code> object Help. This <code>QMenu</code> object does NOT have any submenus.<img src="https://i.stack.imgur.com/gP1Ka.jpg" alt="Perform action when Help menu is clicked"></p>
  
  <p>Can you please advise me how to perform actions when only the <code>QMenu</code> is clicked
  Here's what I have tried, but I got an empty output.</p>
  
  <p><em>mainwindow.h</em></p>
  
  <pre><code>#ifndef MAINWINDOW_H
  #define MAINWINDOW_H
  
  #include &lt;QMainWindow&gt;
  #include &lt;QDebug&gt;
  #include &lt;QSignalMapper&gt;
  
  namespace Ui {
  class MainWindow;
  }
  
  class MainWindow : public QMainWindow
  {
      Q_OBJECT
  
  public:
      explicit MainWindow(QWidget *parent = 0);
      ~MainWindow();
  
  private:
      Ui::MainWindow *ui;
      void createActions();
      QSignalMapper *pSignalMapper;
  
  private slots:
      void help();
  
  };
  
  #endif // MAINWINDOW_H
  </code></pre>
  
  <p><em>mainwindow.cpp</em></p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      createActions();
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
  }
  
  void MainWindow::createActions()
  {
      pSignalMapper = new QSignalMapper(this);
      connect(ui-&gt;menuHelp, SIGNAL(triggered(QAction*)), this, SLOT(help()));
  
  }
  
  void MainWindow::help()
  {
      qDebug()&lt;&lt;"inside help qdialog";
  }
  </code></pre>
  
  <p><em>main.cpp</em></p>
  
  <pre><code>#include "mainwindow.h"
  #include &lt;QApplication&gt;
  #include &lt;ui_mainwindow.h&gt;
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
      MainWindow w;
      w.show();
  
      return a.exec();
  }
  </code></pre>
  
  <p>Output when I click on Help <code>QMenu</code>, absolutely nothing:</p>
  
  <pre><code>Starting E:\Qt2\modules\guiPrototype2\build-guiPrototype2-Desktop_Qt_5_2_0_MSVC2010_32bit-Debug\debug\guiPrototype2.exe...
  </code></pre>