From 535c9ea0783864ae9f0c5593b39b37764bd59821 Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Sun, 26 Jan 2014 18:40:23 +0100 Subject: [PATCH] Override QMainWindow::menuBar() in LyX GuiView class on Mac OSX. This fixes the issue with missing menu entry for "Insert Branch ". --- src/frontends/qt4/GuiView.cpp | 16 ++++++++++------ src/frontends/qt4/GuiView.h | 7 +++++++ status.20x | 3 ++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index fff7f24fd4..6195195252 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -425,13 +425,8 @@ GuiView::GuiView(int id) // they are greyed out. guiApp->setCurrentView(this); -#if defined(Q_WS_MACX) - static QMenuBar * qmb = new QMenuBar(0); -#else - QMenuBar * qmb = menuBar(); -#endif // Fill up the menu bar. - guiApp->menus().fillMenuBar(qmb, this, true); + guiApp->menus().fillMenuBar(menuBar(), this, true); setCentralWidget(d.stack_widget_); @@ -533,6 +528,15 @@ QVector GuiView::GuiViewPrivate::guiWorkAreas() } +#if defined(Q_WS_MACX) +QMenuBar * GuiView::menuBar() const +{ + static QMenuBar * globalMenuBar = new QMenuBar(0); + return globalMenuBar; +} +#endif + + #if QT_VERSION >= 0x040400 void GuiView::processingThreadStarted() diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 667ce60788..02199c1a98 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -137,6 +137,13 @@ public: GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline); void updateStatusBar(); +#if defined(Q_WS_MACX) + // We have to share one menu bar, so we must create a menu bar that does not have a parent. + // To enforce this we override the QMainWindow::menuBar() implementation. + // See https://bugreports.qt-project.org/browse/QTBUG-25399 + QMenuBar *menuBar() const; +#endif + /// updates the possible layouts selectable void updateLayoutList(); void updateToolbars(); diff --git a/status.20x b/status.20x index 1aaa5e251d..4bb4210941 100644 --- a/status.20x +++ b/status.20x @@ -55,8 +55,9 @@ What's new * USER INTERFACE -Fixed python call in listerrors script. +- Fixed python call in listerrors script. +- Fix the missing menu entry for "Insert Branch ". * DOCUMENTATION AND LOCALIZATION -- 2.39.5