Reputation: 13575
For example, I have a menu and add an action in it somewhere. And after some time I want to replace the action by a new one because it becomes invalid. How to implement it?
QMenu* menu = new QMenu(this);
...
QAction* action = menu->addAction("text");
...
QAction* newAction = new QAction(menu);
// how to replace?
Upvotes: 2
Views: 564
Reputation: 3049
// To replace action with yetAnotherAction:
menu->insertAction(action,yetAnotherAction);
menu->removeAction(action);
Upvotes: 5