Fix osx menu roles
This commit is contained in:
parent
068277dbc1
commit
9ff9ba1376
1 changed files with 13 additions and 4 deletions
|
@ -1418,14 +1418,23 @@ QAction *MainWindow::createAction(const char *id, const QString &name,
|
|||
QAction *action = new DVAction(name, this);
|
||||
addAction(action);
|
||||
#ifdef MACOSX
|
||||
// To prevent the wrong menu items (due to MacOS menu naming conventions), from
|
||||
// taking Preferences, Quit, or About roles (sometimes happens unexpectedly in
|
||||
// translations) - all menu items should have "NoRole"
|
||||
if (MenuFileCommandType || MenuEditCommandType || MenuScanCleanupCommandType
|
||||
|| MenuLevelCommandType || MenuXsheetCommandType || MenuCellsCommandType ||
|
||||
MenuViewCommandType || MenuWindowsCommandType) {
|
||||
action->setMenuRole(QAction::NoRole);
|
||||
}
|
||||
// except for Preferences, Quit, and About
|
||||
if (strcmp(id, MI_Preferences) == 0) {
|
||||
action->setMenuRole(QAction::PreferencesRole);
|
||||
}
|
||||
if (strcmp(id, MI_ShortcutPopup) == 0) {
|
||||
action->setMenuRole(QAction::NoRole);
|
||||
if (strcmp(id, MI_Quit) == 0) {
|
||||
action->setMenuRole(QAction::QuitRole);
|
||||
}
|
||||
if (strcmp(id,MI_ExitGroup) == 0) {
|
||||
action->setMenuRole(QAction::NoRole);
|
||||
if (strcmp(id, MI_About) == 0) {
|
||||
action->setMenuRole(QAction::AboutRole);
|
||||
}
|
||||
#endif
|
||||
CommandManager::instance()->define(id, type, defaultShortcut.toStdString(),
|
||||
|
|
Loading…
Reference in a new issue