diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index 62162025d252d809396f682ed307ae82aa9027a4..4dcc85599a88e038afbd2de323af9ac32a8052d1 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -129,3 +129,11 @@ void CppLocatorFilter::accept(Locator::FilterEntry selection) const ModelItemInfo info = qvariant_cast<CppTools::Internal::ModelItemInfo>(selection.internalData); TextEditor::BaseTextEditor::openEditorAt(info.fileName, info.line, info.column); } + +void CppLocatorFilter::reset() +{ + m_searchList.clear(); + m_previousResults.clear(); + m_previousEntry.clear(); + m_forceNewSearchList = true; +} diff --git a/src/plugins/cpptools/cpplocatorfilter.h b/src/plugins/cpptools/cpplocatorfilter.h index c58a9100c1b47d41cd29311bf231f19e34891639..e6e4e29b966244bcb5af661cd1bc417e253e1272 100644 --- a/src/plugins/cpptools/cpplocatorfilter.h +++ b/src/plugins/cpptools/cpplocatorfilter.h @@ -52,6 +52,8 @@ public: void accept(Locator::FilterEntry selection) const; void refresh(QFutureInterface<void> &future); + void reset(); + protected: SearchSymbols search; @@ -64,8 +66,8 @@ private: QHash<QString, QList<ModelItemInfo> > m_searchList; QList<ModelItemInfo> m_previousResults; - bool m_forceNewSearchList; QString m_previousEntry; + bool m_forceNewSearchList; }; } // namespace Internal diff --git a/src/plugins/cpptools/searchsymbols.cpp b/src/plugins/cpptools/searchsymbols.cpp index 01aecaa236ddec4cac2eb28670fdd9d0da56a634..7ce03de8307dd4145d152d3fdcf495861990e2aa 100644 --- a/src/plugins/cpptools/searchsymbols.cpp +++ b/src/plugins/cpptools/searchsymbols.cpp @@ -33,6 +33,7 @@ #include <Scope.h> #include <Names.h> #include <cplusplus/LookupContext.h> +#include <QDebug> using namespace CPlusPlus; using namespace CppTools::Internal; @@ -67,8 +68,11 @@ QList<ModelItemInfo> SearchSymbols::operator()(Document::Ptr doc, const QString accept(doc->globalSymbolAt(i)); } (void) switchScope(previousScope); + QList<ModelItemInfo> result = items; strings.clear(); - return items; + items.clear(); + m_paths.clear(); + return result; } QString SearchSymbols::switchScope(const QString &scope) @@ -124,7 +128,7 @@ bool SearchSymbols::visit(Function *symbol) bool SearchSymbols::visit(Namespace *symbol) { - QString name = findOrInsert(scopedSymbolName(symbol)); + QString name = scopedSymbolName(symbol); QString previousScope = switchScope(name); for (unsigned i = 0; i < symbol->memberCount(); ++i) { accept(symbol->memberAt(i)); @@ -216,7 +220,7 @@ void SearchSymbols::appendItem(const QString &name, QStringList fullyQualifiedName; foreach (const Name *name, LookupContext::fullyQualifiedName(symbol)) - fullyQualifiedName.append(overview.prettyName(name)); + fullyQualifiedName.append(findOrInsert(overview.prettyName(name))); QString path = m_paths.value(symbol->fileId(), QString()); if (path.isEmpty()) { @@ -225,7 +229,7 @@ void SearchSymbols::appendItem(const QString &name, } const QIcon icon = icons.iconForSymbol(symbol); - items.append(ModelItemInfo(name, info, type, + items.append(ModelItemInfo(findOrInsert(name), findOrInsert(info), type, fullyQualifiedName, path, symbol->line(),