]> git.lyx.org Git - lyx.git/commitdiff
Transfer global mac menu bar initialization to GuiApplication ctor.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 26 Dec 2007 09:54:48 +0000 (09:54 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 26 Dec 2007 09:54:48 +0000 (09:54 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22305 a592a061-630c-0410-9148-cb99ea01b6c8

src/MenuBackend.cpp
src/MenuBackend.h
src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiMenubar.cpp
src/frontends/qt4/GuiMenubar.h

index 8686177146c7cf861c49bfab1caf00d4612ebd3c..af26c856ee084d81c31f7fd514ff1e0656015a4b 100644 (file)
@@ -404,7 +404,7 @@ void Menu::checkShortcuts() const
 }
 
 
-bool Menu::searchFunc(FuncRequest & func, stack<docstring> & names)
+bool Menu::searchFunc(FuncRequest & func, stack<docstring> & names) const
 {
        const_iterator m = begin();
        const_iterator m_end = end();
index cfe380180b909aac334c1497bb32de54820ff630..eed0875fa4002d9d908062223c84f38f5d30c6e7 100644 (file)
@@ -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<docstring> & names);
+       bool searchFunc(FuncRequest & func, std::stack<docstring> & names) const;
 
 private:
        friend class MenuBackend;
index 0fe7e284a1618790ceac8660038a4d1ff4e24ece..76e82b3e1294c437f484693588181afbf516a62b 100644 (file)
@@ -51,6 +51,7 @@
 #include <QFileOpenEvent>
 #include <QLocale>
 #include <QLibraryInfo>
+#include <QMenuBar>
 #include <QPixmapCache>
 #include <QRegExp>
 #include <QSessionManager>
@@ -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
index 1c5ed1326317533200a6c4ad2c755a4c575fa773..33e7f0b9b753725b302cdafc9d39ddbf55116cae 100644 (file)
@@ -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,
index 05733dbb13e0380b5443d97b3370acf57b8d90d6..10acf8e701e89e1ddb05abe14543154bf314f5a9 100644 (file)
@@ -56,9 +56,6 @@ private:
 
        /// name to menu for openByName
        NameMap name_map_;
-
-       /// MACOS X special menubar.
-       QMenuBar * mac_menubar_;
 };
 
 } // namespace frontend