From fe82dd7ff72738f23730371dea41b70275be6cc1 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Wed, 14 Jul 2010 13:01:39 +0200
Subject: [PATCH] QmlOutline: Make sure tree view is always expanded

---
 src/plugins/qmljseditor/qmljseditor.cpp  | 7 ++++---
 src/plugins/qmljseditor/qmljsoutline.cpp | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 690464cb600..411d854c1e9 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -856,6 +856,10 @@ void QmlJSTextEditor::updateOutlineNow()
     }
 
     m_outlineModel->update(document, snapshot);
+
+    QTreeView *treeView = static_cast<QTreeView*>(m_outlineCombo->view());
+    treeView->expandAll();
+
     updateOutlineIndexNow();
 }
 
@@ -1401,9 +1405,6 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
         FindDeclarations findDeclarations;
         m_semanticInfo.declarations = findDeclarations(doc->ast());
 
-        QTreeView *treeView = static_cast<QTreeView*>(m_outlineCombo->view());
-        treeView->expandAll();
-
         if (m_contextPane) {
             Node *newNode = m_semanticInfo.declaringMember(position());
             if (newNode) {
diff --git a/src/plugins/qmljseditor/qmljsoutline.cpp b/src/plugins/qmljseditor/qmljsoutline.cpp
index ee3b5bb4fdf..4c018a5b6ed 100644
--- a/src/plugins/qmljseditor/qmljsoutline.cpp
+++ b/src/plugins/qmljseditor/qmljsoutline.cpp
@@ -49,6 +49,8 @@ void QmlJSOutlineWidget::setEditor(QmlJSTextEditor *editor)
     m_editor = editor;
 
     m_treeView->setModel(m_editor.data()->outlineModel());
+    modelUpdated();
+
     connect(m_treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
             this, SLOT(updateSelectionInText(QItemSelection)));
 
-- 
GitLab