diff libgui/src/m-editor/file-editor.cc @ 27089:9326c2258e60

fix visibility of find dialog when editor is docked/undocked (bug #5) * file-editor-interface.h: implementation of virtual slot toplevel_change * file-editor-tab.cc (handle_toplevel_changed): new slot for editor singal when editor toplevel changed, destroying and re-creating find dialog where the state of the dialog is saved in a new structure; (handle_find_dialog_finished): store geometry and visibility in the new data structure of the find dialog; (find_create): new method with the main actions for creating the find dialog moved from find (), this method is called for re-creating the dialog (find): move most of this slot into new method find_create, only leave actions for very first initialization of the dialog; (change_editor_state): use new data struct instead of separate variables for saving and restoring dialog data * file-editor-tab.h: new slot handle_toplevel_changed, new method find_create, new structure for saving dialog data * file-editor.cc (toplevel_changed): implementation of new slot for signal on toplevel changed; (add_file_editor_tab): connect editor signal on toplevel changed to the related slot in file_editor_tab * file-editor.h: new signal fetab_toplevel_changed, new slot toplevel_change * find-dialog.cc (save_data): new method for saving the current state of the find dialog in a structure passed by the caller; (restore_data): new method for restoring the current state from a given data structure; * find-dialog.h: typedef of data structure with enum for the binary options, new methods for saving and restoring data in/from the structure * octave-dock-widget.cc (make_window): manually emit toplevelChanged signal in case we undock a widget since our methid seems to prevent qt from doing so * octave-dock-widget.h: make slot toplevel_changed protected and virtual allowing a re-implementation in specific widgets
author Torsten Lilge <ttl-octave@mailbox.org>
date Tue, 14 May 2019 22:41:32 +0200
parents fb427fafd494
children e83d3161b256
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc	Fri May 10 22:15:37 2019 +0200
+++ b/libgui/src/m-editor/file-editor.cc	Tue May 14 22:41:32 2019 +0200
@@ -1255,6 +1255,12 @@
 
   }
 
+  void file_editor::toplevel_change (bool toplevel)
+  {
+    emit fetab_toplevel_changed (toplevel);
+    octave_dock_widget::toplevel_change (toplevel);
+  }
+
   void file_editor::update_octave_directory (const QString& dir)
   {
     m_ced = dir;
@@ -2357,6 +2363,9 @@
     connect (this, SIGNAL (fetab_set_focus (const QWidget*)),
              f, SLOT (set_focus (const QWidget*)));
 
+    connect (this, SIGNAL (fetab_toplevel_changed (bool)),
+             f, SLOT (handle_toplevel_changed (bool)));
+
     connect (this, SIGNAL (fetab_insert_debugger_pointer (const QWidget*, int)),
              f, SLOT (insert_debugger_pointer (const QWidget*, int)));