Hi -

I am adding QActions to my menu dynamically when a dynamic library is loaded as a plugin. Items get added to a menu using the following funciton:

Qt Code:
  1. QAction* MainWindow::createModuleMenuItem(const QString &text, const QObject *receiver, const char *member) {
  2. return moduleMenu->addAction(text, receiver, member);
  3. }
To copy to clipboard, switch view to plain text mode 

This method works fine for inserting items into menus. However I am having trouble removing items from said menus. I know there is a removeAction function for Menus, but it takes a QAction as an argument, and since I am loading my menu items dynamically, I don't have a name to pass as an arguement to the removeAction function.

In general, I can get items to load into a menu and remove them from a menu when the QAction has a name tied to it (as shown below), but I can't see to figure out how to do it with QActions added to menus without a statically defined name (as shown above).

Qt Code:
  1. QAction *load = new QAction(tr("&Load Workspace"), this);
  2. load->setShortcuts(QKeySequence::Open);
  3. load->setStatusTip(tr("Load a saved workspace"));
  4. connect(load, SIGNAL(triggered()), this, SLOT(loadSettings()));
  5. fileMenu->addAction(load);
  6. fileMenu->removeAction(load)
To copy to clipboard, switch view to plain text mode 

Any advice/help/guidance is appreciated. Thanks.