changeset 25192:8cc3213f788f stable

clean up variable editor method for style and compiler warnings (bug #53443) * variable-editor.cc (variable_editor::tab_to_front): Avoid C-style cast to silence compiler warning from -Wold-style-cast. Delete unnecessary braces and use correct indentation.
author Mike Miller <mtmiller@octave.org>
date Mon, 09 Apr 2018 21:52:43 -0700
parents 09ddb785359e
children 6f1fde568e46
files libgui/src/variable-editor.cc
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/variable-editor.cc	Mon Apr 09 17:51:39 2018 -0700
+++ b/libgui/src/variable-editor.cc	Mon Apr 09 21:52:43 2018 -0700
@@ -1197,18 +1197,15 @@
     if (parent () != nullptr)
       {
         QList<QTabBar *> barlist = main_win ()->findChildren<QTabBar *> ();
+        QVariant this_value (reinterpret_cast<quintptr> (this));
 
         foreach (QTabBar *tbar, barlist)
-          {
-            for (int i=0; i < tbar->count (); i++)
+          for (int i = 0; i < tbar->count (); i++)
+            if (tbar->tabData (i) == this_value)
               {
-                  if ((QWidget *) tbar->tabData (i).toULongLong () == this)
-                  {
-                    tbar->setCurrentIndex (i);
-                    return;
-                  }
+                tbar->setCurrentIndex (i);
+                return;
               }
-          }
       }
   }