Mercurial > hg > octave-nkf
diff libgui/src/history-dock-widget.cc @ 20602:a8cc8318da8c stable
show history context menu only for clicks on entries
* history-dock-widget.cc(ctxMenu): get index of mouse click position and
check whether it is valid before creating and showing the context menu
author | Torsten <ttl@justmail.de> |
---|---|
date | Sat, 25 Jul 2015 22:17:57 +0200 |
parents | 4e15e8cb16ae |
children | 734d446560a8 |
line wrap: on
line diff
--- a/libgui/src/history-dock-widget.cc +++ b/libgui/src/history-dock-widget.cc @@ -179,14 +179,20 @@ void history_dock_widget::ctxMenu (const QPoint &xpos) { QMenu menu (this); - menu.addAction (resource_manager::icon ("edit-copy"), + + QModelIndex index = _history_list_view->indexAt (xpos); + + if (index.isValid () && index.column () == 0) + { + menu.addAction (resource_manager::icon ("edit-copy"), tr ("Copy"), this, SLOT (handle_contextmenu_copy (bool))); - menu.addAction (tr ("Evaluate"), this, + menu.addAction (tr ("Evaluate"), this, SLOT (handle_contextmenu_evaluate (bool))); - menu.addAction (resource_manager::icon ("document-new"), + menu.addAction (resource_manager::icon ("document-new"), tr ("Create script"), this, SLOT (handle_contextmenu_create_script (bool))); - menu.exec (_history_list_view->mapToGlobal (xpos)); + menu.exec (_history_list_view->mapToGlobal (xpos)); + } } void history_dock_widget::handle_contextmenu_copy (bool)