Pyqt - Add a QMenuBar to a QMainWindow which is in another class

531 views Asked by At

I have 2 classes : MainWindow() and Menubar(). MainWindow() is a QMainWindow and Menubar is a QMenuBar. I don't know how I can add the menu bar to the main window.

With the QToolBar, I can make something like this :

self.toolbar = Toolbar() self.addToolBar(self.toolbar)

But with the QMenubar, there isn't any function like "addMenuBar()".

So I can't figure out with it.

1

There are 1 answers

1
Mel On BEST ANSWER

QMainWindow comes with its default QMenuBar, but you can set a new one with QMainWindow.setMenuBar()

More informations in the Qt Documentation