Hello!
I have a problem with a QMenuBar. It doesn't show up properly. Instead of all the QMenu and QAction inside it, it only shows a ">>" symbol like this:
menu.jpg
I can press the symbol and a menu of menus shows up and everything works fine. But this is still a problem. I tried playing around with the size of the widget the QMenuBar is inside, removed all relevant style sheet entries and reduced the contents of the QMenuBar to a single QMenu with one QAction inside. Nothing helps. This happens only on one of two PCs where I tested it (Win XP does not work, Win7 works). The code to produce the menu looks like this:
// Build the menu bar.
menuLayout->setMargin(0);
menuLayout->addWidget(menuBar);
menuLayout->addStretch(1);
ui.menuWidget->setLayout(menuLayout);
QMenu* fileMenu
= menuBar
->addMenu
(tr
("&File"));
QAction* saveStateAction
= fileMenu
->addAction
(tr
("&Save State"));
saveStateAction->setToolTip(tr("Saves the state history."));
connect(saveStateAction, SIGNAL(triggered()), this, SLOT(saveStateHistory()));
// ...and more QMenus and QActions follow.
// Build the menu bar.
QMenuBar* menuBar = new QMenuBar();
QHBoxLayout* menuLayout = new QHBoxLayout(ui.menuWidget);
menuLayout->setMargin(0);
menuLayout->addWidget(menuBar);
menuLayout->addStretch(1);
ui.menuWidget->setLayout(menuLayout);
QMenu* fileMenu = menuBar->addMenu(tr("&File"));
QAction* saveStateAction = fileMenu->addAction(tr("&Save State"));
saveStateAction->setToolTip(tr("Saves the state history."));
saveStateAction->setShortcut(QKeySequence(tr("Ctrl+S")));
connect(saveStateAction, SIGNAL(triggered()), this, SLOT(saveStateHistory()));
// ...and more QMenus and QActions follow.
To copy to clipboard, switch view to plain text mode
Any advice?
thanks,
Cruz
Bookmarks