MainToolBar doesn't show all the options QtWidgets
-
As you can see in the image above, I have a menuBar with three different menus. The first two is to open other windows and the last one is to exit the app.
When I visualize de ui file in the Design mode I can see the three menus but when build the app... it only shows the first two and I don't know why.
I have tried changing the position but nothing happens. It isn't a problem of upgrading the ui file because any other change in the Window is shown.
Can someone help me? -
Hi,
Are you developing on macOS ?
-
@SGaist Yes I am! Is it because of that?
-
The exit action is automagically moved to the menu which has the name your application to match macOS design.
-
You need to specify the menu role for a correct behavior on all platforms.
ex:
action=menu->addAction(tr("Exit")); action->setMenuRole(QAction::QuitRole); action->setShortcut(QKeySequence::Quit);
On OSX, the exit menu will move to the App Menu with the name Quit MyApp.
On Ubuntu usely it's placed at the end of the File menu.Same thing is required with Preferences, About and About Qt .
You can specify the role in the Designer too.
-
More details on the QMenuBar documentation.