PDA

View Full Version : QMenuBar size policy



krivenok
16th January 2006, 12:53
Hellow All!

I use QMainWindow and menuBar() member.
Also I use adjustSize() for my MainWindow!!!
After compile and run I get TWO menubars (probably because of adjustSize()):
---------------------
| File | Edit | View |
---------------------
| Tools | Help |
-----------------

But I want to get ONE menubar, i.e.
-------------------------------------
| File | Edit | View | Tools | Help |
-------------------------------------

How to implement it?

high_flyer
16th January 2006, 13:07
can you show the code in which you set your menubar?

krivenok
16th January 2006, 14:09
void MainWindow::createMenus()
{
// Only register menus (without actions)
menus_["file"] = menuBar()->addMenu(tr("File"));
menus_["view"] = menuBar()->addMenu(tr("View"));
menus_["edit"] = menuBar()->addMenu(tr("Edit"));
menus_["tools"] = menuBar()->addMenu(tr("Tools"));
menus_["help"] = menuBar()->addMenu(tr("Help"));
}

menus_ - is std::map<const std::string,QMenu*>

high_flyer
16th January 2006, 16:13
why do you use adjustSize()? (and where? its not in the code you supplied)
Try not using it, see if it helps.
I don't see anything wrong with code you posted.