From fb10a2345d1f013fd42470ce41e4b70b4c0516f0 Mon Sep 17 00:00:00 2001
From: con <qtc-committer@nokia.com>
Date: Mon, 26 Jul 2010 14:43:48 +0200
Subject: [PATCH] Re-enable expanding on double-click in search results pane.

For some items with Symbols Search this will now both expand and jump to the
result.
---
 src/plugins/find/searchresulttreeitemroles.h | 2 +-
 src/plugins/find/searchresulttreemodel.cpp   | 3 +++
 src/plugins/find/searchresulttreeview.cpp    | 4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/plugins/find/searchresulttreeitemroles.h b/src/plugins/find/searchresulttreeitemroles.h
index d79877e8de5..1e917255b62 100644
--- a/src/plugins/find/searchresulttreeitemroles.h
+++ b/src/plugins/find/searchresulttreeitemroles.h
@@ -44,7 +44,7 @@ enum Roles
     ResultIconRole,
     SearchTermStartRole,
     SearchTermLengthRole,
-    RowOfItem // The ?-th child of its parent is this this item
+    IsGeneratedRole
 };
 
 } // namespace Internal
diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp
index 705dedcf4e6..a03922114dc 100644
--- a/src/plugins/find/searchresulttreemodel.cpp
+++ b/src/plugins/find/searchresulttreemodel.cpp
@@ -217,6 +217,9 @@ QVariant SearchResultTreeModel::data(const SearchResultTreeItem *row, int role)
     case ItemDataRoles::SearchTermLengthRole:
         result = row->item.textMarkLength;
         break;
+    case ItemDataRoles::IsGeneratedRole:
+        result = row->isGenerated();
+        break;
 // TODO this looks stupid in case of symbol tree, is it necessary?
 //    case Qt::BackgroundRole:
 //        if (row->parent() && row->parent()->parent())
diff --git a/src/plugins/find/searchresulttreeview.cpp b/src/plugins/find/searchresulttreeview.cpp
index 4cd46ac30fc..459736dc008 100644
--- a/src/plugins/find/searchresulttreeview.cpp
+++ b/src/plugins/find/searchresulttreeview.cpp
@@ -46,7 +46,7 @@ SearchResultTreeView::SearchResultTreeView(QWidget *parent)
     setItemDelegate(new SearchResultTreeItemDelegate(this));
     setIndentation(14);
     setUniformRowHeights(true);
-    setExpandsOnDoubleClick(false);
+    setExpandsOnDoubleClick(true);
     header()->hide();
 
     connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(emitJumpToSearchResult(QModelIndex)));
@@ -78,6 +78,8 @@ void SearchResultTreeView::addResults(const QList<Find::SearchResultItem> &items
 
 void SearchResultTreeView::emitJumpToSearchResult(const QModelIndex &index)
 {
+    if (model()->data(index, ItemDataRoles::IsGeneratedRole).toBool())
+        return;
     SearchResultItem item = model()->data(index, ItemDataRoles::ResultItemRole).value<SearchResultItem>();
 
     emit jumpToSearchResult(item);
-- 
GitLab