diff libgui/src/m-editor/file-editor-tab.cc @ 16731:01d523d5f796

add help for word at mouse or text cursor to the editors context menu * octave-qscintilla.h: new class derived from qsciscintilla to get acces to the editors context menu * octave-qscxintilla.cc(contextMenuEvent): create standard context menu and add entry for calling help on current word at cursor (contextmenu_help): handler for the new menu entry * libgui/src/module.mk: add new files octave_qscintilla.cc/.h * file-editor-tab.cc(constructor): _edit_area is of class octave_qscintilla, connect the signal of this class for command execution (execute_command_in_terminal): slot for signal connected in contructor * file-editor-tab.h: new slot for executing a command in terminal, _edit_area is of new class octave_qscintilla
author Torsten <ttl@justmail.de>
date Fri, 07 Jun 2013 23:13:48 +0200
parents a71a784c7611
children e81084a745a9
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Thu Jun 06 20:19:48 2013 -0700
+++ b/libgui/src/m-editor/file-editor-tab.cc	Fri Jun 07 23:13:48 2013 +0200
@@ -70,7 +70,14 @@
 
   _file_name = directory;
 
-  _edit_area = new QsciScintilla (this);
+  _edit_area = new octave_qscintilla (this);
+  // Connect signal for command execution to a slot of this tab which in turn
+  // emits a signal connected to the main window.
+  // Direct connection is not possible because tab's parent is null.
+  connect (_edit_area,
+           SIGNAL (execute_command_in_terminal_signal (const QString&)),
+           this,
+           SLOT (execute_command_in_terminal (const QString&)));
 
   // Leave the find dialog box out of memory until requested.
   _find_dialog = 0;
@@ -162,6 +169,12 @@
 }
 
 void
+file_editor_tab::execute_command_in_terminal (const QString& command)
+{
+  emit execute_command_in_terminal_signal (command); // connected to main window
+}
+
+void
 file_editor_tab::set_file_name (const QString& fileName)
 {
   // update tracked file if we really have a file on disk