I am writing a program.
I have a QMainWindow and a function called createMenus() that returns a QMenuBar*.

Within the class QMainWindow, I call: this->setMenuBar(createMenus());

So I have a beautiful MainWindow with a menu in the top.

Now, in "File", I want to put a button that creates a new window (presumably a QWidget?).
And I would like to show the same MenuBar in the top part of my new window.

void QMainWindow::createWindow()
QWidget *window = new QWidget;

QVBoxLayout *center_box = new QVBoxLayout;

#ifndef Q_OS_MAC
QMenuBar *newMenu = createMenus();


This works (in Linux), as a QMenuBar is shown in the new window.
The aftereffect is that the QMenuBar in the QMainWindow has disappeared.

Can someone direct me to the best implementation to create multiple windows with the same QMenuBar?

Kind regards,