From b3a6489752ad61d65ee425c74235c0a3c6901cea Mon Sep 17 00:00:00 2001
From: Christiaan Janssen <christiaan.janssen@nokia.com>
Date: Mon, 18 Jul 2011 14:24:33 +0200
Subject: [PATCH] QmlProfiler: enabled sorting in Callers/Callees tabs

Change-Id: Ieede8580df9f9e7384865aaa9944a29925008fb1
Reviewed-on: http://codereview.qt.nokia.com/1758
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
---
 src/plugins/qmlprofiler/qmlprofilereventview.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp
index 5989f962127..c1ead786352 100644
--- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp
@@ -50,9 +50,13 @@ public:
     {
         if (data().type() == QVariant::String) {
             // first column
-            return data(FilenameRole).toString() == other.data(FilenameRole).toString() ?
+            if (column() == 0) {
+                return data(FilenameRole).toString() == other.data(FilenameRole).toString() ?
                         data(LineRole).toInt() < other.data(LineRole).toInt() :
                         data(FilenameRole).toString() < other.data(FilenameRole).toString();
+            } else {
+                return data().toString() < other.data().toString();
+            }
         }
 
         return data().toDouble() < other.data().toDouble();
@@ -408,7 +412,7 @@ void QmlProfilerEventsView::buildModel()
         bool hasBranches = d->m_fieldShown[Parents] || d->m_fieldShown[Children];
         setRootIsDecorated(hasBranches);
 
-        setSortingEnabled(!hasBranches);
+        setSortingEnabled(true);
 
         if (!hasBranches)
             sortByColumn(d->m_firstNumericColumn,Qt::DescendingOrder);
@@ -474,6 +478,7 @@ void QmlProfilerEventsView::QmlProfilerEventsViewPrivate::buildModelFromList( co
 
         if (m_fieldShown[Details]) {
             newRow << new EventsViewItem(*binding->details);
+            newRow.last()->setData(QVariant(*binding->details));
         }
 
         if (!newRow.isEmpty()) {
-- 
GitLab