2

can someone explain why this statement does nothing?

ui.menuBar->setCornerWidget(ui.menuHelp, Qt::TopRightCorner);

menuBar is a QMenuBar and menuHelp is QMenu

I still get all my QMenu's clustered on the Left Side of the window

BurninatorDor
  • 1,009
  • 5
  • 19
  • 42

1 Answers1

1

To add a menu to the right side of menu bar, you should add a new QMenuBar containing the desired menu as the right corner widget using setCornerWidget :

QMenuBar *bar = new QMenuBar(ui->menuBar);

QMenu *menuHelp = new QMenu("Help", bar);
bar->addMenu(menuHelp);

ui->menuBar->setCornerWidget(bar);
Nejat
  • 31,784
  • 12
  • 106
  • 138