OSDN Git Service

debugger: fix selection of displays of integer-ish data
authorqthjk <qthjk@ovi.com>
Tue, 24 May 2011 14:38:04 +0000 (16:38 +0200)
committerhjk <qthjk@ovi.com>
Tue, 24 May 2011 14:40:26 +0000 (16:40 +0200)
Change-Id: I9e9d22884a53f462b6e7a3e823cb14958c0eccd9
Reviewed-on: http://codereview.qt.nokia.com/93
Reviewed-by: hjk <qthjk@ovi.com>
src/plugins/debugger/watchhandler.cpp

index 9cd7dbd..6f5eb09 100644 (file)
@@ -370,8 +370,10 @@ static inline QString formattedValue(const WatchData &data, int format)
         return reformatInteger(data.value.toLongLong(), format);
     }
 
-    if (data.value.toULongLong(0, 0))
-        return reformatInteger(data.value.toLongLong(), format);
+    bool ok = false;
+    qulonglong integer = data.value.toULongLong(&ok, 0);
+    if (ok)
+       return reformatInteger(integer, format);
 
     QString result = data.value;
     result.replace(QLatin1Char('\n'), QLatin1String("\\n"));
@@ -721,8 +723,9 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
                 return QStringList()
                     << tr("Latin1 string")
                     << tr("UTF8 string");
-            if ((isIntType(data.type) && data.type != "bool")
-                || data.value.toULongLong(0, 0))
+            bool ok = false;
+            (void)data.value.toULongLong(&ok, 0);
+            if ((isIntType(data.type) && data.type != "bool") || ok)
                 return QStringList()
                     << tr("Decimal")
                     << tr("Hexadecimal")