diff libgui/src/octave-dock-widget.h @ 29754:4c569e386e9b

improve behavior of dockable widgets (bug #60750) * main-window.h, main-window.cc (main_window::set_window_layout): Don't reset geometry of adopted dock_widgets. (main_window::construct): Don't connect qt_link edit_variable_signal to main_window edit_variable slot. (main_window::reset_windows): Force reset of all windows. (main_window::do_reset_windows): New argument, FORCE_ALL. Skip adoped dock_widgets unless force_all is true. * octave-dock-widget.h, octave-dock-widget.cc (octave_dock_widget::make_widget): If m_main_window is nonnull, set m_adopted to false. Disconnect any existing m_dock_action signals that are connected to the octave_dock_widget object before connecting the m_dock_action triggered signal to the octave_dock_widget make_window slot. (octave_dock_widget::m_adopted): New data member. (octave_dock_widget::set_adopted, (octave_dock_widget::adopted): New functions. * octave-qobject.h, octave-qobject.cc (base_qobject::documentation_widget, base_qobject::file_browser_widget, base_qobject::history_widget, base_qobject::workspace_widget, base_qobject::variable_editor_widget): Call set_main_window and set_adopted for widget if it already exists and main_window argument is nonnull. Otherwise, create widget if it doesn't already exist. (base_qobject::show_variable_editor_window): Rename slot from edit_variable. Change all uses. Acquire pointer to widget and forward to the widget's edit_variable method. * variable-editor.cc (variable_editor::variable_editor): Call make_window if parent is nullptr. (variable_editor::edit_variable): Don't call make_window.
author John W. Eaton <jwe@octave.org>
date Mon, 14 Jun 2021 12:39:51 -0400
parents 3f61913fdee4
children 5154c91e0d98
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.h	Mon Jun 14 10:42:08 2021 -0400
+++ b/libgui/src/octave-dock-widget.h	Mon Jun 14 12:39:51 2021 -0400
@@ -98,6 +98,9 @@
 
     void set_main_window (main_window *mw);
 
+    void set_adopted (bool adopted = true) { m_adopted = adopted; }
+    bool adopted (void) const { return m_adopted; }
+
   signals:
 
     //! Custom signal that tells whether a user has clicked away that dock
@@ -168,6 +171,7 @@
 
     main_window *m_main_window;
 
+    bool m_adopted;
     bool m_custom_style;
     bool m_focus_follows_mouse;
     int m_title_3d;