mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Free GuiPopupMenu from GuiMenubar.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22301 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
02110a3d5b
commit
3ffd3f51a1
@ -87,7 +87,7 @@ void GuiMenubar::init()
|
||||
Menu menu;
|
||||
menubackend_.expand(menubackend_.getMenubar(), menu, owner_->buffer());
|
||||
|
||||
GuiPopupMenu * qMenu = new GuiPopupMenu(this, *m, true);
|
||||
GuiPopupMenu * qMenu = new GuiPopupMenu(owner_, *m, true);
|
||||
owner_->menuBar()->addMenu(qMenu);
|
||||
|
||||
name_map_[toqstr(name)] = qMenu;
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "Action.h"
|
||||
#include "GuiPopupMenu.h"
|
||||
#include "GuiMenubar.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "LyXFunc.h"
|
||||
#include "MenuBackend.h"
|
||||
@ -28,9 +27,9 @@
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GuiPopupMenu::GuiPopupMenu(GuiMenubar * owner, MenuItem const & mi,
|
||||
GuiPopupMenu::GuiPopupMenu(GuiView * owner, MenuItem const & mi,
|
||||
bool topLevelMenu)
|
||||
: QMenu(owner->menuBar()), owner_(owner)
|
||||
: QMenu(owner), owner_(owner)
|
||||
{
|
||||
name_ = mi.submenuname();
|
||||
|
||||
@ -52,12 +51,12 @@ void GuiPopupMenu::updateView()
|
||||
return;
|
||||
|
||||
// Here, We make sure that theLyXFunc points to the correct LyXView.
|
||||
theLyXFunc().setLyXView(owner_->view());
|
||||
theLyXFunc().setLyXView(owner_);
|
||||
|
||||
Menu const & fromLyxMenu = owner_->backend().getMenu(name_);
|
||||
owner_->backend().expand(fromLyxMenu, topLevelMenu_, owner_->view()->buffer());
|
||||
Menu const & fromLyxMenu = menubackend.getMenu(name_);
|
||||
menubackend.expand(fromLyxMenu, topLevelMenu_, owner_->buffer());
|
||||
|
||||
if (!owner_->backend().hasMenu(topLevelMenu_.name())) {
|
||||
if (!menubackend.hasMenu(topLevelMenu_.name())) {
|
||||
LYXERR(Debug::GUI, "\tWARNING: menu seems empty"
|
||||
<< to_utf8(topLevelMenu_.name()));
|
||||
}
|
||||
@ -99,7 +98,7 @@ void GuiPopupMenu::populate(QMenu * qMenu, Menu * menu)
|
||||
docstring label = getLabel(*m);
|
||||
addBinding(label, *m);
|
||||
|
||||
Action * action = new Action(*(owner_->view()),
|
||||
Action * action = new Action(*(owner_),
|
||||
QIcon(), toqstr(label), m->func(), QString());
|
||||
qMenu->addAction(action);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class GuiMenubar;
|
||||
class GuiView;
|
||||
|
||||
/// a submenu
|
||||
class GuiPopupMenu : public QMenu
|
||||
@ -28,7 +28,7 @@ class GuiPopupMenu : public QMenu
|
||||
Q_OBJECT
|
||||
public:
|
||||
///
|
||||
GuiPopupMenu(GuiMenubar * owner, MenuItem const & mi,
|
||||
GuiPopupMenu(GuiView * owner, MenuItem const & mi,
|
||||
bool topLevelMenu = false);
|
||||
|
||||
/// populates the menu or one of its submenu
|
||||
@ -45,8 +45,8 @@ private:
|
||||
/// add binding keys a the menu item label.
|
||||
void addBinding(docstring & label, MenuItem const & mi);
|
||||
|
||||
/// our owning menubar
|
||||
GuiMenubar * owner_;
|
||||
/// our owning view
|
||||
GuiView * owner_;
|
||||
/// the name of this menu
|
||||
docstring name_;
|
||||
/// Top Level Menu
|
||||
|
Loading…
Reference in New Issue
Block a user