Вопрос

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