From 569815e79dbb76a99033560d811fb5f1fb2f292e Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Tue, 2 Aug 2011 16:57:13 +0000 Subject: [PATCH] correct mac specific menu code for Cocoa based Qt build git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39411 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/Menus.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index eb4d0b2a86..8689b32f05 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -1746,9 +1746,10 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb) {LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole} }; const size_t num_entries = sizeof(entries) / sizeof(entries[0]); + const bool first_call = mac_special_menu_.size() == 0; // the special menu for Menus. Fill it up only once. - if (mac_special_menu_.size() == 0) { + if (first_call) { for (size_t i = 0 ; i < num_entries ; ++i) { FuncRequest const func(entries[i].action, from_utf8(entries[i].arg)); @@ -1756,17 +1757,26 @@ void Menus::Impl::macxMenuBarInit(GuiView * view, QMenuBar * qmb) entries[i].label, func)); } } - + // add the entries to a QMenu that will eventually be empty // and therefore invisible. QMenu * qMenu = qmb->addMenu("special"); MenuDefinition::const_iterator cit = mac_special_menu_.begin(); MenuDefinition::const_iterator end = mac_special_menu_.end(); for (size_t i = 0 ; cit != end ; ++cit, ++i) { +#if defined(QT_MAC_USE_COCOA) && (QT_MAC_USE_COCOA > 0) + if (first_call || entries[i].role != QAction::ApplicationSpecificRole) { + Action * action = new Action(view, QIcon(), cit->label(), + cit->func(), QString(), qMenu); + action->setMenuRole(entries[i].role); + qMenu->addAction(action); + } +#else Action * action = new Action(view, QIcon(), cit->label(), cit->func(), QString(), qMenu); action->setMenuRole(entries[i].role); qMenu->addAction(action); +#endif } } -- 2.39.2