From ac263ef261a6dcea141ffa77a6cbc9b86c286c62 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Wed, 20 Oct 2010 11:52:54 +0200
Subject: [PATCH] QmlOutline: Speed up updates

Guard the incremental updates with beginResetModel/endResetModel

This gives better overall performance then passing the incremental
updates to the views.

Tested-by: Lasse Holmstedt
---
 src/plugins/qmljseditor/qmloutlinemodel.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp
index a004804868c..e07a9f6f0d1 100644
--- a/src/plugins/qmljseditor/qmloutlinemodel.cpp
+++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp
@@ -367,6 +367,10 @@ void QmlOutlineModel::update(const SemanticInfo &semanticInfo)
     m_treePos.append(0);
     m_currentItem = invisibleRootItem();
 
+    // resetModel() actually gives better average performance
+    // then the incremental updates.
+    beginResetModel();
+
     m_typeToIcon.clear();
     m_itemToNode.clear();
     m_itemToIdNode.clear();
@@ -376,6 +380,8 @@ void QmlOutlineModel::update(const SemanticInfo &semanticInfo)
     QmlOutlineModelSync syncModel(this);
     syncModel(m_semanticInfo.document);
 
+    endResetModel();
+
     emit updated();
 }
 
-- 
GitLab