Mercurial > octave
changeset 25199:8cff7eceee87 stable
Do Variable Editor focus retention and titlebar highlight properly (bug #53410).
* variable_editor.cc (variable_editor::variable_editor): Remove the m_main
QMainWindow proxy.
(variable_editor::focusInEvent): Added. Add after the base class virtual
focusInEvent() by setting the focus to the active variable widget.
* variable_editor.h (variable_editor::focusInEvent): Added. Declaration of
overriding virtual function.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Mon, 09 Apr 2018 18:35:45 -0500 |
parents | 2f0c0c0652d5 |
children | b3ee0179d7b0 |
files | libgui/src/variable-editor.cc libgui/src/variable-editor.h |
diffstat | 2 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/variable-editor.cc Tue Apr 10 12:19:02 2018 -0400 +++ b/libgui/src/variable-editor.cc Mon Apr 09 18:35:45 2018 -0500 @@ -1029,12 +1029,21 @@ m_main->setCentralWidget (central_mdiarea); setWidget (m_main); - setFocusProxy (m_main); connect (this, SIGNAL (command_signal (const QString&)), p, SLOT (execute_command_in_terminal (const QString&))); } + void variable_editor::focusInEvent (QFocusEvent *ev) + { + octave_dock_widget::focusInEvent (ev); + + // set focus to the current variable + QWidget *fw = m_main->focusWidget (); + if (fw != nullptr) + fw->setFocus (); + } + // Add an action to a menu or the widget itself. QAction*
--- a/libgui/src/variable-editor.h Tue Apr 10 12:19:02 2018 -0400 +++ b/libgui/src/variable-editor.h Mon Apr 09 18:35:45 2018 -0500 @@ -334,6 +334,10 @@ void selected_command_signal (const QString& cmd); + protected: + + void focusInEvent (QFocusEvent *ev); + private: QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text,