changeset 17085:ceca3e65a8fe

make sure a central menu bar does not show a widgets title but "Octave" * main_window.cc(set_window_layout): show docked widgets, then main window, and finally the floating widgets to make sure the main window ist the first shown window * octave-gui.cc(octave_start_gui): do not show main window here
author Torsten <ttl@justmail.de>
date Thu, 25 Jul 2013 21:51:54 +0200
parents cb8543396024
children 872947f3f9f1
files libgui/src/main-window.cc libgui/src/octave-gui.cc
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/main-window.cc
+++ b/libgui/src/main-window.cc
@@ -542,6 +542,8 @@
 void
 main_window::set_window_layout (QSettings *settings)
 {
+  QList<octave_dock_widget *> float_and_visible;
+
   // Restore the geometry of all dock-widgets
   foreach (octave_dock_widget *widget, dock_widget_list ())
     {
@@ -564,12 +566,21 @@
           // make widget visible if desired
           bool visible = settings->value
               ("DockWidgets/" + name + "Visible", true).toBool ();
-          widget->setVisible (visible);
+          if (floating && visible)              // floating and visible
+            float_and_visible.append (widget);  // not show before main win
+          else
+            widget->setVisible (visible);       // not floating -> show
         }
     }
 
   restoreState (settings->value ("MainWindow/windowState").toByteArray ());
   restoreGeometry (settings->value ("MainWindow/geometry").toByteArray ());
+  show ();  // main window is ready and can be shown (as first window)
+
+  // show floating widgets after main win to ensure "Octave" in central menu
+  foreach (octave_dock_widget *widget, float_and_visible)
+     widget->setVisible (true);
+
 }
 
 void
--- a/libgui/src/octave-gui.cc
+++ b/libgui/src/octave-gui.cc
@@ -127,9 +127,7 @@
 
           // create main window, read settings, and show window
           main_window w;
-          w.read_settings ();  // get widget settings after construction
-                               // but before showing
-          w.show ();
+          w.read_settings ();  // get widget settings and window layout
           w.focus_command_window ();
           w.connect_visibility_changed (); // connect signals for changes in
                                            // visibility not before w is shown