diff options
Diffstat (limited to 'src/gui/widgets/qmenu_mac.mm')
-rw-r--r-- | src/gui/widgets/qmenu_mac.mm | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 43722a1..6a0eb53 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -909,6 +909,7 @@ static NSMenuItem *qt_mac_menu_merge_action(OSMenuRef merge, QMacMenuAction *act static QString qt_mac_menu_merge_text(QMacMenuAction *action) { QString ret; + extern QString qt_mac_applicationmenu_string(int type); #ifdef QT_MAC_USE_COCOA QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); #endif @@ -916,34 +917,25 @@ static QString qt_mac_menu_merge_text(QMacMenuAction *action) ret = action->action->text(); #ifndef QT_MAC_USE_COCOA else if (action->command == kHICommandAbout) - ret = QMenuBar::tr("About %1").arg(qAppName()); + ret = qt_mac_applicationmenu_string(6).arg(qAppName()); else if (action->command == kHICommandAboutQt) ret = QMenuBar::tr("About Qt"); else if (action->command == kHICommandPreferences) - ret = QMenuBar::tr("Preferences"); + ret = qt_mac_applicationmenu_string(4); else if (action->command == kHICommandQuit) - ret = QMenuBar::tr("Quit %1").arg(qAppName()); + ret = qt_mac_applicationmenu_string(5).arg(qAppName()); #else else if (action->menuItem == [loader aboutMenuItem]) { - if (action->action->text() == QString("About %1").arg(qAppName())) - ret = QMenuBar::tr("About %1").arg(qAppName()); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(6).arg(qAppName()); } else if (action->menuItem == [loader aboutQtMenuItem]) { if (action->action->text() == QString("About Qt")) ret = QMenuBar::tr("About Qt"); else ret = action->action->text(); } else if (action->menuItem == [loader preferencesMenuItem]) { - if (action->action->text() == QString("Preferences")) - ret = QMenuBar::tr("Preferences"); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(4); } else if (action->menuItem == [loader quitMenuItem]) { - if (action->action->text() == QString("Quit %1").arg(qAppName())) - ret = QMenuBar::tr("About %1").arg(qAppName()); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(5).arg(qAppName()); } #endif return ret; @@ -1399,7 +1391,11 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action) } else { [item setTitle: qt_mac_QStringToNSString(finalString)]; } - [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))]; + + if (action->action->menuRole() == QAction::AboutRole || action->action->menuRole() == QAction::QuitRole) + [item setTitle:qt_mac_QStringToNSString(text)]; + else + [item setTitle:qt_mac_QStringToNSString(qt_mac_removeMnemonics(text))]; // Cocoa Enabled [item setEnabled: action->action->isEnabled()]; @@ -2060,6 +2056,22 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly() QWidget *w = findWindowThatShouldDisplayMenubar(); QMenuBar *mb = findMenubarForWindow(w); + // We need to see if we are in full screen mode, if so we need to + // switch the full screen mode to be able to show or hide the menubar. + if(w && mb) { + // This case means we are creating a menubar, check if full screen + if(w->isFullScreen()) { + // Ok, switch to showing the menubar when hovering over it. + SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); + } + } else if(w) { + // Removing a menubar + if(w->isFullScreen()) { + // Ok, switch to not showing the menubar when hovering on it + SetSystemUIMode(kUIModeAllHidden, 0); + } + } + if (mb && mb->isNativeMenuBar()) { bool modal = QApplicationPrivate::modalState(); #ifdef QT_MAC_USE_COCOA |