Adding an action to the root of mainwindow menubar ?
-
I'm trying to add 'Std_Worbench', a Freecad command (a wrapped action), to the main menubar.
This Std_Worbench is basically an action group. Not a menu with submenu items.How can I add this directly to the root of the menubar? Because as you can see it's now in a submenu workbench/workbench/... which looks dumb.
I'm trying to add the action directly to the menubar, but it doesn't work.
Application::Instance->commandManager().addTo("Std_Workbench", menuBar);
This is in fact calling down the line :
QWidget::addAction(QAction)
So it's equivalent to
menuBar->addAction(Std_Workbench)
Is that possible?
Bonus question: How can I change the font size/bold and background color of only one menu item?
-
Hi,
On which OS are you on ?
-
Hi @SGaist
Edit: The main issue is solved. Std_Workbench was reimplementing addTo and was creating a sub menu in which it added the actions.
So sorry for disturbing.However I'm still very interested to know how to customize the style of that particular menuBar item. I want to change :
- Background color to blue
- font color to white
- Font size
- Font to bold.
- add an icon
Also I need to change the menu title to the selected workbench name and icon when a workbench is selected.
-
For the icon QMenu has the icon properly.
For the rest either through a stylesheet or a proxy style.