سؤال

Is there a quick way to clear the menu bar i.e. Remove all menus in PyQt.

The reason I ask is that I am developing a modular application. Each module provides it's own menus and gives a weighting to where that menu should appear. Each module can also add a menuAction to another modules menu, however when that happens it changes the order of the menus. What i want to do is when the menus have finished being created is to remove them all and then re add them.

I know this will work because I can re add them now and they appear in the correct order but all the previous menus are still there.

هل كانت مفيدة؟

المحلول

did you try QMenu.clear (self)

mymenu = QtGui.QMenu("Menu")

mymenu.clear()
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top