# HG changeset patch # User Daniel J Sebald # Date 1523316945 18000 # Node ID 8cff7eceee87ffb96f46821e7c47051eb04ed069 # Parent 2f0c0c0652d5ec532295ffb35374fbf425f1c3c7 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. diff -r 2f0c0c0652d5 -r 8cff7eceee87 libgui/src/variable-editor.cc --- 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* diff -r 2f0c0c0652d5 -r 8cff7eceee87 libgui/src/variable-editor.h --- 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,