diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index b3d3b872ee..00114bfe88 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -209,7 +209,7 @@ void Menus::macxMenuBarInit(GuiView * view) QAction::ApplicationSpecificRole}, {LFUN_LYX_QUIT, "", "Quit LyX", QAction::QuitRole} }; - const size_t num_entries = sizeof(entries) / sizeof(MacMenuEntry); + const size_t num_entries = sizeof(entries) / sizeof(entries[0]); // the special menu for Menus. Menu special; @@ -218,15 +218,14 @@ void Menus::macxMenuBarInit(GuiView * view) from_utf8(entries[i].arg)); special.add(MenuItem(MenuItem::Command, entries[i].label, func)); } - specialMenu(special); + setSpecialMenu(special); // add the entries to a QMenu that will eventually be empty // and therefore invisible. QMenu * qMenu = view->menuBar()->addMenu("special"); // we do not use 'special' because it is a temporary variable, - // whereas Menus::specialMenu points to a persistent - // copy. + // whereas Menus::specialMenu points to a persistent copy. Menu::const_iterator cit = specialMenu().begin(); Menu::const_iterator end = specialMenu().end(); for (size_t i = 0 ; cit != end ; ++cit, ++i) { @@ -234,7 +233,6 @@ void Menus::macxMenuBarInit(GuiView * view) cit->func(), QString()); action->setMenuRole(entries[i].role); qMenu->addAction(action); - } } @@ -302,14 +300,7 @@ QString MenuItem::binding() const } -Menu & Menu::add(MenuItem const & i) -{ - items_.push_back(i); - return *this; -} - - -Menu & Menu::addWithStatusCheck(MenuItem const & i) +void Menu::addWithStatusCheck(MenuItem const & i) { switch (i.kind()) { @@ -352,12 +343,10 @@ Menu & Menu::addWithStatusCheck(MenuItem const & i) default: items_.push_back(i); } - - return *this; } -Menu & Menu::read(Lexer & lex) +void Menu::read(Lexer & lex) { enum Menutags { md_item = 1, @@ -526,7 +515,6 @@ Menu & Menu::read(Lexer & lex) } } lex.popTable(); - return *this; } @@ -591,12 +579,6 @@ bool Menu::searchMenu(FuncRequest const & func, vector & names) const } -void Menus::specialMenu(Menu const & menu) -{ - specialmenu_ = menu; -} - - namespace { bool compareFormat(Format const * p1, Format const * p2) diff --git a/src/frontends/qt4/Menus.h b/src/frontends/qt4/Menus.h index c20eccbd82..0b7d1a92f6 100644 --- a/src/frontends/qt4/Menus.h +++ b/src/frontends/qt4/Menus.h @@ -167,12 +167,12 @@ public: explicit Menu(QString const & name = QString()) : name_(name) {} /// Add the menu item unconditionally - Menu & add(MenuItem const &); + void add(MenuItem const & item) { items_.push_back(item); } /// Checks the associated FuncRequest status before adding the /// menu item. - Menu & addWithStatusCheck(MenuItem const &); + void addWithStatusCheck(MenuItem const &); /// - Menu & read(Lexer &); + void read(Lexer &); /// QString const & name() const { return name_; } /// @@ -246,7 +246,7 @@ public: that will be removed by expand() in other menus. This is used by the Qt/Mac code */ - void specialMenu(Menu const &); + void setSpecialMenu(Menu const & menu) { specialmenu_ = menu; } /// Menu const & specialMenu() { return specialmenu_; }