changeset 29598:c7b104ebed4d

eliminate octave_dock_widget::main_win function * variable-editor.cc (variable_editor::tab_to_front): Use parentWidget instad of calling main_win. * octave_dock_widget.h (octave_dock_widget::main_win): Delete.
author John W. Eaton <jwe@octave.org>
date Mon, 03 May 2021 13:48:26 -0400
parents 07591becbc40
children 2b5bc8367135
files libgui/src/octave-dock-widget.h libgui/src/variable-editor.cc
diffstat 2 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-dock-widget.h	Mon May 03 13:30:29 2021 -0400
+++ b/libgui/src/octave-dock-widget.h	Mon May 03 13:48:26 2021 -0400
@@ -130,8 +130,6 @@
 
     void handle_active_dock_changed (octave_dock_widget*, octave_dock_widget*);
 
-    QMainWindow * main_win (void) { return m_parent; }
-
     void save_settings (void);
 
     void moveEvent (QMoveEvent *event);
@@ -179,7 +177,6 @@
     QRect m_recent_float_geom;
     QRect m_recent_dock_geom;
     bool m_waiting_for_mouse_button_release;
-
   };
 }
 
--- a/libgui/src/variable-editor.cc	Mon May 03 13:30:29 2021 -0400
+++ b/libgui/src/variable-editor.cc	Mon May 03 13:48:26 2021 -0400
@@ -1362,18 +1362,25 @@
   void
   variable_editor::tab_to_front (void)
   {
-    if (parent () != nullptr)
+    QWidget *parent = parentWidget ();
+
+    if (parent)
       {
-        QList<QTabBar *> barlist = main_win ()->findChildren<QTabBar *> ();
+        QList<QTabBar *> barlist = parent->findChildren<QTabBar *> ();
+
         QVariant this_value (reinterpret_cast<quintptr> (this));
 
         for (auto *tbar : barlist)
-          for (int i = 0; i < tbar->count (); i++)
-            if (tbar->tabData (i) == this_value)
+          {
+            for (int i = 0; i < tbar->count (); i++)
               {
-                tbar->setCurrentIndex (i);
-                return;
+                if (tbar->tabData (i) == this_value)
+                  {
+                    tbar->setCurrentIndex (i);
+                    return;
+                  }
               }
+          }
       }
   }