By the way, you are using QMenuBar *, while addToolBar() returns QToolBar*

As for the answer, use QMainWindow::addToolBarBreak between addToolBar functions