My menu items were added through the UI designer. I can't seem to find a proper solution. I've asked on IRC and this solution How do I set QMenu to align to the right of a toolbar? was not clear to me.
Is there a simple way to do this by accessing the UI code in the MainWindow constructor? Or any other pointers?
To add a menu to the right side of menu bar, you can 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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With