]> git.lyx.org Git - features.git/commitdiff
Do not use toobar menu as fallback context menu
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 5 Jul 2017 10:28:26 +0000 (12:28 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 5 Jul 2017 10:28:26 +0000 (12:28 +0200)
This is a consequence of e91572a0, although it is not clear why. The
contextMenuEvent code of the workarea should not delegate context
menu when it cannot honor it.

Also fix a small memory leak.

Fixes bug #10616.

src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiWorkArea.cpp

index 7b7189743ecd1de84b5588b48a03cd2c79781c31..5ff15c8e49255b4a20ca74abde9f3b9f368bab86 100644 (file)
@@ -3440,8 +3440,7 @@ bool GuiView::goToFileRow(string const & argument)
 
 void GuiView::toolBarPopup(const QPoint & /*pos*/)
 {
-       QMenu * menu = new QMenu;
-       menu = guiApp->menus().menu(toqstr("context-toolbars"), * this);
+       QMenu * menu = guiApp->menus().menu(toqstr("context-toolbars"), * this);
        menu->exec(QCursor::pos());
 }
 
index 5810e680a4f13eb2683cfa084b53a0ef8daa2faa..7b46eee74f9ea40fa93dd7dd8c135699a593af1d 100644 (file)
@@ -777,7 +777,7 @@ void GuiWorkArea::contextMenuEvent(QContextMenuEvent * e)
        }
 
        if (name.empty()) {
-               QAbstractScrollArea::contextMenuEvent(e);
+               e->accept();
                return;
        }
        // always show mnemonics when the keyboard is used to show the context menu
@@ -785,7 +785,7 @@ void GuiWorkArea::contextMenuEvent(QContextMenuEvent * e)
        bool const keyboard = (e->reason() == QContextMenuEvent::Keyboard);
        QMenu * menu = guiApp->menus().menu(toqstr(name), *d->lyx_view_, keyboard);
        if (!menu) {
-               QAbstractScrollArea::contextMenuEvent(e);
+               e->accept();
                return;
        }
        // Position the menu to the right.