Format size columns properly
authorAndrey Kvochko <a.kvochko@samsung.com>
Thu, 21 Sep 2017 13:08:28 +0000 (16:08 +0300)
committerAndrey Kvochko/SRR-Compiler Lab/./삼성전자 <a.kvochko@samsung.com>
Fri, 27 Oct 2017 10:46:13 +0000 (13:46 +0300)
src/analyze/gui/objecttreemodel.cpp
src/analyze/gui/objecttreemodel.h

index b3fd264..bb2feaa 100644 (file)
@@ -119,9 +119,15 @@ QVariant ObjectTreeModel::data(const QModelIndex& index, int role) const
         case InstanceCountColumn:
             return static_cast<qint64>(row->allocations);
         case ShallowSizeColumn:
-            return static_cast<qint64>(row->allocated);
+            if (role == SortRole) {
+                return static_cast<qint64>(row->allocated);
+            }
+            return m_format.formatByteSize(row->allocated, 1, KFormat::JEDECBinaryDialect);
         case ReferencedSizeColumn:
-            return static_cast<qint64>(row->referenced);
+            if (role == SortRole) {
+                return static_cast<qint64>(row->referenced);
+            }
+            return m_format.formatByteSize(row->referenced, 1, KFormat::JEDECBinaryDialect);
         case GCNumColumn:
             return static_cast<quint64>(row->gcNum);
         case NUM_COLUMNS:
index 97229c1..d635d4f 100644 (file)
@@ -86,6 +86,7 @@ private:
     int rowOf(const ObjectRowData* row) const;
 
     ObjectTreeData m_data;
+    KFormat m_format;
 };
 
 #endif // OBJECTTREEMODEL_H