[Qt-interest] How does one dynamically modify a menu?

noam.rosenthal at nokia.com noam.rosenthal at nokia.com
Mon Feb 7 02:37:28 CET 2011


On Feb 6, 2011, at 5:23 PM, ext K. Frank wrote:

Hello All!

How can I replace one menu with another at run time?  (Alternatively,
how can I replace menu items in a menu?)

I see that QMenuBar has an addMenu function and QMenu has an
addAction function, but they have neither a removeMenu nor a a
removeAction function, respectively.


QMenu does have a removeAction method, though it doesn't appear in the doc since it's not overloaded from QWidget.
http://doc.qt.nokia.com/4.7/qwidget.html#removeAction

<http://doc.qt.nokia.com/4.7/qwidget.html#removeAction>IIRC you can use that function to remove a menu from the menubar

menuBar->removeAction(menu->menuAction());

~No'am
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110207/0f2b48b9/attachment.html 


More information about the Qt-interest-old mailing list