I have posted code above. Where I am calling pMenu->clear();

Qt Code:
  1. QString strAg = "ITEM %1";
  2. QMenu * pMenu = new QMenu;
  3.  
  4. if(pMenu)
  5. {
  6. pMenu->clear(); //CLEAR DOES NOT WORK
  7. disconnect(pMenu,0,0,0);
  8.  
  9. for ( int item = 0; item < m_strItemList.count(); ++item )
  10. {
  11.  
  12. QAcrion * pAction = pMenu->addAction(strArg.arg(m_strItemList[item] )); //Adding Action to the Menu
  13.  
  14. QSignalMapper* mapper = new QSignalMapper(pMenu);
  15. mapper->setMapping(pAction, 1)
  16. connect(pAction, SIGNAL(triggered()), mapper, SLOT(map()));
  17. connect(mapper, SIGNAL(mapped(int)), this, SLOT(RunItem(int)));
  18.  
  19. }
To copy to clipboard, switch view to plain text mode