octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53443] Compile warning when casting QVariant


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #53443] Compile warning when casting QVariant to (QWidget *)
Date: Mon, 9 Apr 2018 22:27:56 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0

Follow-up Comment #25, bug #53443 (project octave):

And on the stable 4.4 branch to fix the compiler warning? Something like this
change seems a lot clearer to me than what we have now:


--- a/libgui/src/variable-editor.cc
+++ b/libgui/src/variable-editor.cc
@@ -1197,12 +1197,13 @@ namespace octave
     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 ((QWidget *) tbar->tabData (i).toULongLong () == this)
+                if (tbar->tabData (i) == this_value)
                   {
                     tbar->setCurrentIndex (i);
                     return;


It eliminates the warning for me, but does this work? What am I looking for to
test that this does the right thing?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53443>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]