From 4803a77708aac1f8fce6f44c261d23f7419913b9 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 26 Dec 2007 09:54:48 +0000 Subject: [PATCH] Transfer global mac menu bar initialization to GuiApplication ctor. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22305 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/MenuBackend.cpp | 2 +- src/MenuBackend.h | 2 +- src/frontends/qt4/GuiApplication.cpp | 3 +++ src/frontends/qt4/GuiMenubar.cpp | 8 +------- src/frontends/qt4/GuiMenubar.h | 3 --- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index 8686177146..af26c856ee 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -404,7 +404,7 @@ void Menu::checkShortcuts() const } -bool Menu::searchFunc(FuncRequest & func, stack & names) +bool Menu::searchFunc(FuncRequest & func, stack & names) const { const_iterator m = begin(); const_iterator m_end = end(); diff --git a/src/MenuBackend.h b/src/MenuBackend.h index cfe380180b..eed0875fa4 100644 --- a/src/MenuBackend.h +++ b/src/MenuBackend.h @@ -190,7 +190,7 @@ public: // search for func in this menu iteratively, and put menu // names in a stack. - bool searchFunc(FuncRequest & func, std::stack & names); + bool searchFunc(FuncRequest & func, std::stack & names) const; private: friend class MenuBackend; diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 0fe7e284a1..76e82b3e12 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -170,6 +171,8 @@ GuiApplication::GuiApplication(int & argc, char ** argv) << fromqstr(language_name)); #ifdef Q_WS_MACX + // all windows in a Mac application share the same menu bar. + QMenuBar *menuBar = new QMenuBar(0); // This allows to translate the strings that appear in the LyX menu. addMenuTranslator(); #endif diff --git a/src/frontends/qt4/GuiMenubar.cpp b/src/frontends/qt4/GuiMenubar.cpp index 1c5ed13263..33e7f0b9b7 100644 --- a/src/frontends/qt4/GuiMenubar.cpp +++ b/src/frontends/qt4/GuiMenubar.cpp @@ -98,11 +98,7 @@ void GuiMenubar::init() } -GuiMenubar::~GuiMenubar() { -#ifdef Q_WS_MACX - delete mac_menubar_; -#endif -} +GuiMenubar::~GuiMenubar() {} void GuiMenubar::openByName(QString const & name) { @@ -137,8 +133,6 @@ void GuiMenubar::openByName(QString const & name) void GuiMenubar::macxMenuBarInit() { - mac_menubar_ = new QMenuBar; - /* Since Qt 4.2, the qt/mac menu code has special code for specifying the role of a menu entry. However, it does not work very well with our scheme of creating menus on demand, diff --git a/src/frontends/qt4/GuiMenubar.h b/src/frontends/qt4/GuiMenubar.h index 05733dbb13..10acf8e701 100644 --- a/src/frontends/qt4/GuiMenubar.h +++ b/src/frontends/qt4/GuiMenubar.h @@ -56,9 +56,6 @@ private: /// name to menu for openByName NameMap name_map_; - - /// MACOS X special menubar. - QMenuBar * mac_menubar_; }; } // namespace frontend -- 2.39.5