How can I add Menubar in Qt Designer?
-
I know, it's kinda simple question, but I cannot find a way to add a menubar to a main window of my application? Is it even possible?
-
-
@CuriousPan QMainWindow comes with a QMenuBar by default:
The section where "Type Here" is is the QMenuBar.
You can remove the QMenuBar by right clicking on this section and selecting the option "Remove Menu Bar". If it is removed then right click on the window and select the option "Create Menu Bar".
-
@eyllanesc, excuse me, what am I doing wrong or am I clicking on some wrong place?
-
@CuriousPan I don't think it explains correctly, the QMainWindow already comes with a QMenuBar by default so you don't have to add it. If you removed it then you can add it by clicking on the window (it must be a section where there are no other widgets)
-
@eyllanesc, I'm clicking on a black space of MainWidget (the one which is default and cannot be deleted), but unfortunately nothing appears.
The reason I'm trying to add MenuBar is it was deleted when a development started and then I needed it. -
@CuriousPan said in How can I add Menubar in Qt Designer?:
black space
It's not black space where you have to click, its the grey space with the dots...
-
@CuriousPan I just tested: removed menu bar, right clicked on the empty space inside main window and the top (first) menu entry is the one to add menu bar...
-
@CuriousPan In theory it is possible (using layouts, etc) but don't complicate your life: better use QMainWindow.
Note: "MainWindow" is different to "MainWidget"
-
@eyllanesc, the reason I'd like to stay with a widget I'm having right now is that I have quite a lot already implemented on it.
-
@CuriousPan said in How can I add Menubar in Qt Designer?:
Is it possible to add menu bar to QWidget?
Yes, in code, not in designer.
-
@CuriousPan I don't think the process of converting the code from QWidget to QMainWindow is complicated, in general they are small changes