From 22fb31557f376f0161a42411e11f6b66c057a38c Mon Sep 17 00:00:00 2001
From: Ulf Hermann <ulf.hermann@digia.com>
Date: Fri, 13 Jun 2014 19:14:12 +0200
Subject: [PATCH] QmlProfiler: remove useless signals

Sending a signal for every model when clearing or loading data is not
very smart.

Change-Id: Ifc81d74f6b7f93bcd6748a919dfb553050b8d725
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
---
 src/plugins/qmlprofiler/abstracttimelinemodel.cpp   | 5 -----
 src/plugins/qmlprofiler/abstracttimelinemodel.h     | 3 ---
 src/plugins/qmlprofiler/qml/CategoryLabel.qml       | 4 ++--
 src/plugins/qmlprofiler/timelinemodelaggregator.cpp | 5 +++--
 src/plugins/qmlprofiler/timelinemodelaggregator.h   | 1 -
 5 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/src/plugins/qmlprofiler/abstracttimelinemodel.cpp b/src/plugins/qmlprofiler/abstracttimelinemodel.cpp
index c5b380fbca..2f10e17e06 100644
--- a/src/plugins/qmlprofiler/abstracttimelinemodel.cpp
+++ b/src/plugins/qmlprofiler/abstracttimelinemodel.cpp
@@ -192,11 +192,6 @@ void AbstractTimelineModel::dataChanged()
     default:
         break;
     }
-
-    emit stateChanged();
-    emit dataAvailable();
-    emit emptyChanged();
-    emit expandedChanged();
 }
 
 bool AbstractTimelineModel::eventAccepted(const QmlProfilerDataModel::QmlEventTypeData &event) const
diff --git a/src/plugins/qmlprofiler/abstracttimelinemodel.h b/src/plugins/qmlprofiler/abstracttimelinemodel.h
index 9eeabeb41b..813384d989 100644
--- a/src/plugins/qmlprofiler/abstracttimelinemodel.h
+++ b/src/plugins/qmlprofiler/abstracttimelinemodel.h
@@ -90,9 +90,6 @@ public:
     Q_INVOKABLE virtual float getHeight(int index) const;
 
 signals:
-    void dataAvailable();
-    void stateChanged();
-    void emptyChanged();
     void expandedChanged();
 
 protected:
diff --git a/src/plugins/qmlprofiler/qml/CategoryLabel.qml b/src/plugins/qmlprofiler/qml/CategoryLabel.qml
index b1febce69d..c324035234 100644
--- a/src/plugins/qmlprofiler/qml/CategoryLabel.qml
+++ b/src/plugins/qmlprofiler/qml/CategoryLabel.qml
@@ -53,6 +53,8 @@ Item {
     }
 
     function getDescriptions() {
+        expanded = qmlProfilerModelProxy.expanded(modelIndex);
+        backgroundMarks.requestPaint();
         visible = qmlProfilerModelProxy.rowCount(modelIndex) > 0;
         if (!visible)
             return;
@@ -75,8 +77,6 @@ Item {
     Connections {
         target: qmlProfilerModelProxy
         onExpandedChanged: {
-            expanded = qmlProfilerModelProxy.expanded(modelIndex);
-            backgroundMarks.requestPaint();
             getDescriptions();
         }
 
diff --git a/src/plugins/qmlprofiler/timelinemodelaggregator.cpp b/src/plugins/qmlprofiler/timelinemodelaggregator.cpp
index 9054dccbf6..0d7bb543c2 100644
--- a/src/plugins/qmlprofiler/timelinemodelaggregator.cpp
+++ b/src/plugins/qmlprofiler/timelinemodelaggregator.cpp
@@ -82,14 +82,15 @@ void TimelineModelAggregator::setModelManager(QmlProfilerModelManager *modelMana
         rangeModel->setModelManager(modelManager);
         addModel(rangeModel);
     }
+
+    // Connect this last so that it's executed after the models have updated their data.
+    connect(modelManager->qmlModel(),SIGNAL(changed()),this,SIGNAL(stateChanged()));
 }
 
 void TimelineModelAggregator::addModel(AbstractTimelineModel *m)
 {
     d->modelList << m;
-    connect(m,SIGNAL(emptyChanged()),this,SIGNAL(emptyChanged()));
     connect(m,SIGNAL(expandedChanged()),this,SIGNAL(expandedChanged()));
-    connect(m,SIGNAL(stateChanged()),this,SIGNAL(stateChanged()));
 }
 
 QStringList TimelineModelAggregator::categoryTitles() const
diff --git a/src/plugins/qmlprofiler/timelinemodelaggregator.h b/src/plugins/qmlprofiler/timelinemodelaggregator.h
index ce5d5dca0e..8e1a933cb9 100644
--- a/src/plugins/qmlprofiler/timelinemodelaggregator.h
+++ b/src/plugins/qmlprofiler/timelinemodelaggregator.h
@@ -92,7 +92,6 @@ public:
 signals:
     void dataAvailable();
     void stateChanged();
-    void emptyChanged();
     void expandedChanged();
 
 protected slots:
-- 
GitLab