PDA

View Full Version : Add QMenuBar into QWidget



Cucus
7th July 2011, 20:08
Hi,

I'm trying to add a QMenuBar in a QWidget but I m lost in a step, I tell you all the work done for the moment:

I've create a layout in the QWidget called MenuBar
I promote the layout to QMenuBar and associate this layout to a classe: menuBar.cpp (with header menuBar.h)
I create those classes.

What's next?

PD: I have attached an image which I hope it will help....

mcosta
7th July 2011, 20:23
Why don't you use a QMainWindow?
QMenuBar is designed to be used within it.

Cucus
7th July 2011, 20:59
At the beginning of the project, the bar wasn't necessary, but now they told me to do it. So I have a QWidget with all the project in.

mcosta
7th July 2011, 21:15
Create a QMainWindow and use your QWidget as centralWidget.

gbstack
3rd May 2014, 09:49
Like mcosta said, using QMainWindow is a good choice.
But if you insisting using QWidget to add menu bar, this post may be helpful to you: Qt QWidget add menu bar (http://redino.net/blog/2014/05/qt-qwidget-add-menu-bar/)