Mercurial > octave
changeset 32336:269aa0454b35
gui: Avoid using deprecated function "setActiveWindow".
* libgui/src/octave-dock-widget.cc (octave_dock_widget::make_widget): Use
"activateWindow" instead of "setActiveWindow".
* libgui/src/variable-editor.cc
(variable_editor::restore_hovered_focus_variable): Raise widget before
activating it. Remove call to deprecated "setActiveWindow". Minor style
changes.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Tue, 26 Sep 2023 13:22:45 +0200 |
parents | 2b44805fc139 |
children | c7e895118db1 |
files | libgui/src/octave-dock-widget.cc libgui/src/variable-editor.cc |
diffstat | 2 files changed, 5 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.cc Mon Sep 25 18:52:36 2023 +0200 +++ b/libgui/src/octave-dock-widget.cc Tue Sep 26 13:22:45 2023 +0200 @@ -380,7 +380,7 @@ } raise (); - QApplication::setActiveWindow (this); + activateWindow (); if (vis) {
--- a/libgui/src/variable-editor.cc Mon Sep 25 18:52:36 2023 +0200 +++ b/libgui/src/variable-editor.cc Tue Sep 26 13:22:45 2023 +0200 @@ -1574,15 +1574,11 @@ void variable_editor::restore_hovered_focus_variable () { - variable_dock_widget *tofocus = findChild<variable_dock_widget *> (m_hovered_focus_vname); - if (tofocus != nullptr) + variable_dock_widget *tofocus + = findChild<variable_dock_widget *> (m_hovered_focus_vname); + if (tofocus) { - // Note that this may be platform and window system dependent. - // On a particular Linux system, activateWindow() alone didn't - // immediately set the active window and there was a race - // between the window focus and action signal. Setting the - // active window via the QApplication route did work. - QApplication::setActiveWindow(tofocus->window()); + tofocus->raise (); tofocus->activateWindow (); tofocus->setFocus (Qt::OtherFocusReason); }