diff --git a/src/plugins/bookmarks/bookmarkfilter.cpp b/src/plugins/bookmarks/bookmarkfilter.cpp index ecaa90ff6ad..b0f162ff1d8 100644 --- a/src/plugins/bookmarks/bookmarkfilter.cpp +++ b/src/plugins/bookmarks/bookmarkfilter.cpp @@ -43,12 +43,11 @@ BookmarkFilter::BookmarkFilter(BookmarkManager *manager) setShortcutString("b"); } -QList BookmarkFilter::matchesFor(QFutureInterface &future, - const QString &entry) +void BookmarkFilter::prepareSearch(const QString &entry) { - Q_UNUSED(future) + m_results = {}; if (m_manager->rowCount() == 0) - return QList(); + return; auto match = [this](const QString &name, BookmarkManager::Roles role) { return m_manager->match(m_manager->index(0, 0), role, name, -1, @@ -74,7 +73,6 @@ QList BookmarkFilter::matchesFor(QFutureInterface entries; for (const QModelIndex &idx : matches) { const Bookmark *bookmark = m_manager->bookmarkForIndex(idx); const QString filename = bookmark->fileName().fileName(); @@ -112,9 +110,16 @@ QList BookmarkFilter::matchesFor(QFutureInterfaceicon(); - entries.append(filterEntry); + m_results.append(filterEntry); } - return entries; +} + +QList BookmarkFilter::matchesFor(QFutureInterface &future, + const QString &entry) +{ + Q_UNUSED(future) + Q_UNUSED(entry) + return m_results; } void BookmarkFilter::accept(LocatorFilterEntry selection, QString *newText, diff --git a/src/plugins/bookmarks/bookmarkfilter.h b/src/plugins/bookmarks/bookmarkfilter.h index ff378d9a908..da5102a5fe1 100644 --- a/src/plugins/bookmarks/bookmarkfilter.h +++ b/src/plugins/bookmarks/bookmarkfilter.h @@ -37,6 +37,7 @@ class BookmarkFilter : public Core::ILocatorFilter Q_OBJECT public: explicit BookmarkFilter(BookmarkManager *manager); + void prepareSearch(const QString &entry) override; QList matchesFor(QFutureInterface &future, const QString &entry) override; void accept(Core::LocatorFilterEntry selection, QString *newText, @@ -45,6 +46,7 @@ public: private: BookmarkManager *m_manager = nullptr; // not owned + QList m_results; }; } // namespace Internal