Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix osx menu roles

artisteacher9ff9ba137693
diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp
index e75ed5f5e..8b5fa16bd 100644
--- a/toonz/sources/toonz/mainwindow.cpp
+++ b/toonz/sources/toonz/mainwindow.cpp
@@ -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(),