comparison libgui/src/workspace-model.cc @ 31699:ca3e6e324d54

use signal/slot connection for debugging tooltips in editor * octave-qscintilla.h, octave-qscintilla.cc (octave_qscintalla::show_symbol_tooltip_signal): New signal. (octave_qscintalla::event): Emit show_symbol_tooltip_signal instead of accessing workspace model through octave_qobject. * file-editor.h, file-editor.cc (file_editor::show_symbol_tooltip_signal): New signal. (file_editor::make_file_editor_tab): Forward show_symbol_tooltip_signal from octave_qscintalla to file_editor. * workspace-model.h, workspace-model.cc (workspace_model::show_symbol_tooltip): New function. * main-window.cc (main_window::adopt_editor_widget): Connect file_editor::show_symbol_tooltip_signal to workspace_model::show_symbol_tooltip slot.
author John W. Eaton <jwe@octave.org>
date Mon, 02 Jan 2023 12:25:42 -0500
parents deb553ac2c54
children 14084c7a32ed
comparison
equal deleted inserted replaced
31698:276a992d0c08 31699:ca3e6e324d54
28 #endif 28 #endif
29 29
30 #include <iostream> 30 #include <iostream>
31 31
32 #include <QTreeWidget> 32 #include <QTreeWidget>
33 #include <QToolTip>
33 34
34 #include "gui-preferences-ws.h" 35 #include "gui-preferences-ws.h"
35 #include "gui-settings.h" 36 #include "gui-settings.h"
36 #include "workspace-model.h" 37 #include "workspace-model.h"
37 38
217 218
218 } 219 }
219 } 220 }
220 221
221 void 222 void
223 workspace_model::show_symbol_tooltip (const QPoint& pos,
224 const QString& symbol)
225 {
226 int symbol_idx = m_symbols.indexOf (symbol);
227
228 if (symbol_idx > -1)
229 QToolTip::showText (pos, symbol + " = " + m_values.at (symbol_idx));
230 else
231 QToolTip::hideText ();
232 }
233
234 void
222 workspace_model::clear_data (void) 235 workspace_model::clear_data (void)
223 { 236 {
224 m_top_level = false; 237 m_top_level = false;
225 m_syminfo_list = symbol_info_list (); 238 m_syminfo_list = symbol_info_list ();
226 m_scopes = QString (); 239 m_scopes = QString ();