replace with simpler fix, thx Andre

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24301 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2008-04-16 20:42:33 +00:00
parent 8d4b7cf4ff
commit 6beb9f973c

View File

@ -1130,7 +1130,7 @@ void Menu::Impl::populate(QMenu & qMenu, MenuDefinition const & menu)
/////////////////////////////////////////////////////////////////////
Menu::Menu(GuiView * gv, QString const & name, bool top_level)
: d(new Menu::Impl)
: QMenu(gv), d(new Menu::Impl)
{
d->top_level_menu = top_level? new MenuDefinition : 0;
d->view = gv;
@ -1189,7 +1189,7 @@ struct Menus::Impl {
///
MenuDefinition menubar_;
typedef QMap<GuiView *, QHash<QString, boost::shared_ptr<Menu> > > NameMap;
typedef QMap<GuiView *, QHash<QString, Menu*> > NameMap;
/// name to menu for \c menu() method.
NameMap name_map_;
@ -1519,7 +1519,7 @@ void Menus::fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial)
menu->setTitle(label(*m));
qmb->addMenu(menu);
d->name_map_[view][name] = boost::shared_ptr<Menu>(menu);
d->name_map_[view][name] = menu;
}
}
@ -1554,14 +1554,14 @@ void Menus::updateMenu(Menu * qmenu)
Menu * Menus::menu(QString const & name, GuiView & view)
{
LYXERR(Debug::GUI, "Context menu requested: " << fromqstr(name));
Menu * menu = d->name_map_[&view].value(name, boost::shared_ptr<Menu>()).get();
Menu * menu = d->name_map_[&view].value(name, 0);
if (!menu && !name.startsWith("context-")) {
LYXERR0("requested context menu not found: " << fromqstr(name));
return 0;
}
menu = new Menu(&view, name, true);
d->name_map_[&view][name] = boost::shared_ptr<Menu>(menu);
d->name_map_[&view][name] = menu;
return menu;
}