]> git.lyx.org Git - lyx.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>
Sat, 15 Jul 2017 14:21:41 +0000 (16:21 +0200)
This is a consequence of 060a9664, 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.

(cherry picked from commit ab81c23656b59aa14c41b8acc45f0f3e410ed785)

src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiWorkArea.cpp
status.22x

index 8d8ca5916a11aab68648cd3ef37686e747bfcbbb..bb54b0aa5cf0c2a3613d32b6c4d632637cf38f5b 100644 (file)
@@ -3361,8 +3361,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 6bf68cd09ad490b347e5088b2c40fbbdb3aafc9f..bfedecc182b288f3781370f1810d8e936d1d040e 100644 (file)
@@ -784,7 +784,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
@@ -792,7 +792,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.
index 72e014bef1352143d5c3f09601b2c75456c169d6..6a06b68d03049f39023771a7c461ed17b915d9af 100644 (file)
@@ -100,6 +100,8 @@ What's new
 
 - Don't swallow labels not entered through the toolbar in mathed (bug 10546).
 
+- Fix bad context menu on insets that do not have one (bug 10626).
+
 
 * INTERNALS