changeset: 16748:5b6160fa66f0 tag: editor_tooltip tag: qbase tag: qtip tag: tip user: Torsten date: Tue Jun 11 19:49:44 2013 +0200 summary: imported patch editor_tooltip diff -r 9d0739413904 -r 5b6160fa66f0 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Tue Jun 11 15:09:13 2013 +0800 +++ b/libgui/src/m-editor/octave-qscintilla.cc Tue Jun 11 19:49:44 2013 +0200 @@ -27,6 +27,8 @@ #ifdef HAVE_QSCINTILLA #include +#include +#include #include "octave-qscintilla.h" #include "file-editor-tab.h" @@ -98,4 +100,28 @@ emit execute_command_in_terminal_signal (command); } + +// reimplemented event handler: catching the tooltip event and show own tooltip +bool +octave_qscintilla::event (QEvent *e) +{ + if (e->type () == QEvent::ToolTip) + { + QHelpEvent *he = static_cast (e); + QString word = wordAtPoint (he->pos ()); + if (!word.isEmpty ()) + { + QToolTip::showText (he->globalPos (), word); + } + else + { + QToolTip::hideText (); + e->ignore (); + } + return true; + } + return QObject::event(e); +} + + #endif diff -r 9d0739413904 -r 5b6160fa66f0 libgui/src/m-editor/octave-qscintilla.h --- a/libgui/src/m-editor/octave-qscintilla.h Tue Jun 11 15:09:13 2013 +0800 +++ b/libgui/src/m-editor/octave-qscintilla.h Tue Jun 11 19:49:44 2013 +0200 @@ -39,6 +39,7 @@ #ifdef HAVE_QSCI_VERSION_2_6_0 virtual void contextMenuEvent (QContextMenuEvent *e); #endif + virtual bool event (QEvent *e); signals: