diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp index 124ec906b1f..2b81b509659 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp @@ -83,8 +83,12 @@ QList CMakeLocatorFilter::matchesFor(QFutureInterface< return m_result; } -void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection) const +void CMakeLocatorFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) // Get the project containing the target selected const auto cmakeProject = qobject_cast( Utils::findOrDefault(SessionManager::projects(), [selection](Project *p) { diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h index 374c5816fa7..28fede0f751 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.h @@ -40,7 +40,8 @@ public: void prepareSearch(const QString &entry) override; QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; private: diff --git a/src/plugins/coreplugin/locator/basefilefilter.cpp b/src/plugins/coreplugin/locator/basefilefilter.cpp index df624793ddf..4d7cb124f38 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.cpp +++ b/src/plugins/coreplugin/locator/basefilefilter.cpp @@ -180,8 +180,12 @@ QList BaseFileFilter::matchesFor(QFutureInterface matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; protected: void setFileIterator(Iterator *iterator); diff --git a/src/plugins/coreplugin/locator/commandlocator.cpp b/src/plugins/coreplugin/locator/commandlocator.cpp index 14e57ad0178..bb38336656c 100644 --- a/src/plugins/coreplugin/locator/commandlocator.cpp +++ b/src/plugins/coreplugin/locator/commandlocator.cpp @@ -95,8 +95,12 @@ QList CommandLocator::matchesFor(QFutureInterface= 0 && index < d->commands.size(), return); diff --git a/src/plugins/coreplugin/locator/commandlocator.h b/src/plugins/coreplugin/locator/commandlocator.h index 1ce2eb0226e..f3b855e587b 100644 --- a/src/plugins/coreplugin/locator/commandlocator.h +++ b/src/plugins/coreplugin/locator/commandlocator.h @@ -47,7 +47,8 @@ public: QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; private: diff --git a/src/plugins/coreplugin/locator/executefilter.cpp b/src/plugins/coreplugin/locator/executefilter.cpp index d46550a5698..47f53687925 100644 --- a/src/plugins/coreplugin/locator/executefilter.cpp +++ b/src/plugins/coreplugin/locator/executefilter.cpp @@ -79,8 +79,12 @@ QList ExecuteFilter::matchesFor(QFutureInterface(this); const QString value = selection.displayName.trimmed(); diff --git a/src/plugins/coreplugin/locator/executefilter.h b/src/plugins/coreplugin/locator/executefilter.h index 32d8f78705b..1bf14d831d7 100644 --- a/src/plugins/coreplugin/locator/executefilter.h +++ b/src/plugins/coreplugin/locator/executefilter.h @@ -51,7 +51,8 @@ public: ExecuteFilter(); QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &) override {} private: diff --git a/src/plugins/coreplugin/locator/externaltoolsfilter.cpp b/src/plugins/coreplugin/locator/externaltoolsfilter.cpp index 7307473168b..72b75303f38 100644 --- a/src/plugins/coreplugin/locator/externaltoolsfilter.cpp +++ b/src/plugins/coreplugin/locator/externaltoolsfilter.cpp @@ -47,8 +47,12 @@ QList ExternalToolsFilter::matchesFor(QFutureInterface(); QTC_ASSERT(tool, return); diff --git a/src/plugins/coreplugin/locator/externaltoolsfilter.h b/src/plugins/coreplugin/locator/externaltoolsfilter.h index 86ebf5f851b..0da84363295 100644 --- a/src/plugins/coreplugin/locator/externaltoolsfilter.h +++ b/src/plugins/coreplugin/locator/externaltoolsfilter.h @@ -38,7 +38,8 @@ public: QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; void prepareSearch(const QString &entry) override; diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp index 78510d46ff1..7a4be1eee9d 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.cpp +++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp @@ -57,8 +57,7 @@ QList *categorize(const QString &entry, const QString &candi } // anynoumous namespace -FileSystemFilter::FileSystemFilter(LocatorWidget *locatorWidget) - : m_locatorWidget(locatorWidget) +FileSystemFilter::FileSystemFilter() { setId("Files in file system"); setDisplayName(tr("Files in File System")); @@ -148,15 +147,18 @@ QList FileSystemFilter::matchesFor(QFutureInterfaceshow(value, value.length()); + *newText = value; + *selectionStart = value.length(); return; } else if (!info.exists()) { QFile file(selection.internalData.toString()); diff --git a/src/plugins/coreplugin/locator/filesystemfilter.h b/src/plugins/coreplugin/locator/filesystemfilter.h index 63384e2cd91..57cd96206eb 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.h +++ b/src/plugins/coreplugin/locator/filesystemfilter.h @@ -36,25 +36,23 @@ namespace Core { namespace Internal { -class LocatorWidget; - class FileSystemFilter : public ILocatorFilter { Q_OBJECT public: - explicit FileSystemFilter(LocatorWidget *locatorWidget); + explicit FileSystemFilter(); void prepareSearch(const QString &entry) override; QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; QByteArray saveState() const override; void restoreState(const QByteArray &state) override; bool openConfigDialog(QWidget *parent, bool &needsRefresh) override; void refresh(QFutureInterface &) override {} private: - LocatorWidget *m_locatorWidget; bool m_includeHidden = true; QString m_currentDocumentDirectory; }; diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.cpp b/src/plugins/coreplugin/locator/ilocatorfilter.cpp index 7dfde167414..966654c1c0d 100644 --- a/src/plugins/coreplugin/locator/ilocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/ilocatorfilter.cpp @@ -419,10 +419,12 @@ void ILocatorFilter::setConfigurable(bool configurable) */ /*! - \fn void ILocatorFilter::accept(LocatorFilterEntry selection) const + \fn void ILocatorFilter::accept(LocatorFilterEntry selection, QString *newText, int *selectionStart, int *selectionLength) const Called with the entry specified by \a selection when the user activates it in the result list. + Implementations can return a new search term \a newText, which has \a selectionLength characters + starting from \a selectionStart preselected, and the cursor set to the end of the selection. */ /*! diff --git a/src/plugins/coreplugin/locator/ilocatorfilter.h b/src/plugins/coreplugin/locator/ilocatorfilter.h index fba8d19b2fb..f9430511570 100644 --- a/src/plugins/coreplugin/locator/ilocatorfilter.h +++ b/src/plugins/coreplugin/locator/ilocatorfilter.h @@ -117,7 +117,8 @@ public: virtual QList matchesFor(QFutureInterface &future, const QString &entry) = 0; - virtual void accept(LocatorFilterEntry selection) const = 0; + virtual void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const = 0; virtual void refresh(QFutureInterface &future) = 0; diff --git a/src/plugins/coreplugin/locator/locator.cpp b/src/plugins/coreplugin/locator/locator.cpp index 91e80fc4bf7..addb172db28 100644 --- a/src/plugins/coreplugin/locator/locator.cpp +++ b/src/plugins/coreplugin/locator/locator.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -89,31 +90,29 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) m_settingsPage = new LocatorSettingsPage(this); m_corePlugin->addObject(m_settingsPage); - m_locatorWidget = new LocatorWidget(this); - m_locatorWidget->setEnabled(false); - StatusBarWidget *view = new StatusBarWidget; - view->setWidget(m_locatorWidget); - view->setContext(Context("LocatorWidget")); - view->setPosition(StatusBarWidget::First); - m_corePlugin->addAutoReleasedObject(view); - - QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); + QAction *action = new QAction(Utils::Icons::ZOOM.icon(), tr("Locate..."), this); Command *cmd = ActionManager::registerAction(action, Constants::LOCATE); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); - connect(action, &QAction::triggered, this, &Locator::openLocator); - connect(cmd, &Command::keySequenceChanged, - this, [this, cmd]() { updatePlaceholderText(cmd); }); - updatePlaceholderText(cmd); + connect(action, &QAction::triggered, this, [] { + LocatorManager::show(QString()); + }); ActionContainer *mtools = ActionManager::actionContainer(Constants::M_TOOLS); mtools->addAction(cmd); - m_corePlugin->addObject(new LocatorManager(m_locatorWidget)); + auto locatorWidget = new LocatorWidget(this); + StatusBarWidget *view = new StatusBarWidget; + view->setWidget(locatorWidget); + view->setContext(Context("LocatorWidget")); + view->setPosition(StatusBarWidget::First); + m_corePlugin->addAutoReleasedObject(view); + + m_corePlugin->addObject(new LocatorManager(locatorWidget)); m_openDocumentsFilter = new OpenDocumentsFilter; m_corePlugin->addObject(m_openDocumentsFilter); - m_fileSystemFilter = new FileSystemFilter(m_locatorWidget); + m_fileSystemFilter = new FileSystemFilter(); m_corePlugin->addObject(m_fileSystemFilter); m_executeFilter = new ExecuteFilter(); @@ -122,7 +121,7 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) m_externalToolsFilter = new ExternalToolsFilter; m_corePlugin->addObject(m_externalToolsFilter); - m_corePlugin->addAutoReleasedObject(new LocatorFiltersFilter(this, m_locatorWidget)); + m_corePlugin->addAutoReleasedObject(new LocatorFiltersFilter(this)); #ifdef Q_OS_OSX m_corePlugin->addAutoReleasedObject(new SpotlightLocatorFilter); #endif @@ -130,21 +129,6 @@ void Locator::initialize(CorePlugin *corePlugin, const QStringList &, QString *) connect(ICore::instance(), &ICore::saveSettingsRequested, this, &Locator::saveSettings); } -void Locator::updatePlaceholderText(Command *command) -{ - QTC_ASSERT(command, return); - if (command->keySequence().isEmpty()) - m_locatorWidget->setPlaceholderText(tr("Type to locate")); - else - m_locatorWidget->setPlaceholderText(tr("Type to locate (%1)").arg( - command->keySequence().toString(QKeySequence::NativeText))); -} - -void Locator::openLocator() -{ - m_locatorWidget->show(QString()); -} - void Locator::extensionsInitialized() { m_filters = ExtensionSystem::PluginManager::getObjects(); @@ -198,11 +182,10 @@ void Locator::loadSettings() settings->endGroup(); settings->endGroup(); - m_locatorWidget->updateFilterList(); - m_locatorWidget->setEnabled(true); if (m_refreshTimer.interval() > 0) m_refreshTimer.start(); m_settingsInitialized = true; + emit filtersChanged(); } void Locator::updateEditorManagerPlaceholderText() @@ -296,7 +279,7 @@ void Locator::setFilters(QList f) { m_filters = f; updateEditorManagerPlaceholderText(); // possibly some shortcut changed - m_locatorWidget->updateFilterList(); + emit filtersChanged(); } void Locator::setCustomFilters(QList filters) diff --git a/src/plugins/coreplugin/locator/locator.h b/src/plugins/coreplugin/locator/locator.h index 84b1ab64de6..40e560e97d2 100644 --- a/src/plugins/coreplugin/locator/locator.h +++ b/src/plugins/coreplugin/locator/locator.h @@ -40,7 +40,6 @@ namespace Core { namespace Internal { class CorePlugin; -class LocatorWidget; class OpenDocumentsFilter; class FileSystemFilter; class LocatorSettingsPage; @@ -65,17 +64,17 @@ public: int refreshInterval(); void setRefreshInterval(int interval); +signals: + void filtersChanged(); + public slots: void refresh(QList filters = QList()); void saveSettings(); - void openLocator(); private: - void updatePlaceholderText(Core::Command *command); void loadSettings(); void updateEditorManagerPlaceholderText(); - LocatorWidget *m_locatorWidget; LocatorSettingsPage *m_settingsPage; bool m_settingsInitialized = false; diff --git a/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp b/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp index ae61898aeac..9b72dff0d81 100644 --- a/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp +++ b/src/plugins/coreplugin/locator/locatorfiltersfilter.cpp @@ -35,10 +35,8 @@ using namespace Core::Internal; Q_DECLARE_METATYPE(ILocatorFilter*) -LocatorFiltersFilter::LocatorFiltersFilter(Locator *plugin, - LocatorWidget *locatorWidget): +LocatorFiltersFilter::LocatorFiltersFilter(Locator *plugin): m_plugin(plugin), - m_locatorWidget(locatorWidget), m_icon(Utils::Icons::NEXT.icon()) { setId("FiltersFilter"); @@ -87,15 +85,18 @@ QList LocatorFiltersFilter::matchesFor(QFutureInterface= 0 && index < m_filterShortcutStrings.size(), return); const QString shortcutString = m_filterShortcutStrings.at(index); - if (!shortcutString.isEmpty()) - m_locatorWidget->show(shortcutString + QLatin1Char(' '), - shortcutString.length() + 1); + if (!shortcutString.isEmpty()) { + *newText = shortcutString + QLatin1Char(' '); + *selectionStart = shortcutString.length() + 1; + } } void LocatorFiltersFilter::refresh(QFutureInterface &future) diff --git a/src/plugins/coreplugin/locator/locatorfiltersfilter.h b/src/plugins/coreplugin/locator/locatorfiltersfilter.h index a97cc9493af..238eb440abb 100644 --- a/src/plugins/coreplugin/locator/locatorfiltersfilter.h +++ b/src/plugins/coreplugin/locator/locatorfiltersfilter.h @@ -33,7 +33,6 @@ namespace Core { namespace Internal { class Locator; -class LocatorWidget; /*! This filter provides the user with the list of available Locator filters. @@ -44,19 +43,18 @@ class LocatorFiltersFilter : public ILocatorFilter Q_OBJECT public: - LocatorFiltersFilter(Locator *plugin, - LocatorWidget *locatorWidget); + LocatorFiltersFilter(Locator *plugin); // ILocatorFilter void prepareSearch(const QString &entry) override; QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; private: Locator *m_plugin; - LocatorWidget *m_locatorWidget; QStringList m_filterShortcutStrings; QStringList m_filterDisplayNames; QIcon m_icon; diff --git a/src/plugins/coreplugin/locator/locatorwidget.cpp b/src/plugins/coreplugin/locator/locatorwidget.cpp index 55ffc5c93c6..e05a09337ad 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.cpp +++ b/src/plugins/coreplugin/locator/locatorwidget.cpp @@ -283,7 +283,6 @@ LocatorWidget::LocatorWidget(Locator *qop) : setAttribute(Qt::WA_Hover); setFocusProxy(m_fileLineEdit); - setWindowTitle(tr("Locate...")); resize(200, 90); QSizePolicy sizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); @@ -296,7 +295,6 @@ LocatorWidget::LocatorWidget(Locator *qop) : layout->setMargin(0); layout->addWidget(m_fileLineEdit); - setWindowIcon(Utils::Icons::ZOOM.icon()); const QPixmap pixmap = Utils::Icons::MAGNIFIER.pixmap(); m_fileLineEdit->setFiltering(true); m_fileLineEdit->setButtonPixmap(Utils::FancyLineEdit::Left, pixmap); @@ -345,11 +343,27 @@ LocatorWidget::LocatorWidget(Locator *qop) : m_showProgressTimer.setSingleShot(true); m_showProgressTimer.setInterval(50); // don't show progress for < 50ms tasks connect(&m_showProgressTimer, &QTimer::timeout, [this]() { setProgressIndicatorVisible(true);}); + + Command *locateCmd = ActionManager::command(Constants::LOCATE); + if (QTC_GUARD(locateCmd)) { + connect(locateCmd, &Command::keySequenceChanged, this, [this,locateCmd] { + updatePlaceholderText(locateCmd); + }); + updatePlaceholderText(locateCmd); + } + + connect(m_locatorPlugin, &Locator::filtersChanged, this, &LocatorWidget::updateFilterList); + updateFilterList(); } -void LocatorWidget::setPlaceholderText(const QString &text) +void LocatorWidget::updatePlaceholderText(Command *command) { - m_fileLineEdit->setPlaceholderText(text); + QTC_ASSERT(command, return); + if (command->keySequence().isEmpty()) + m_fileLineEdit->setPlaceholderText(tr("Type to locate")); + else + m_fileLineEdit->setPlaceholderText(tr("Type to locate (%1)").arg( + command->keySequence().toString(QKeySequence::NativeText))); } void LocatorWidget::updateFilterList() @@ -658,10 +672,17 @@ void LocatorWidget::acceptCurrentEntry() if (!index.isValid()) return; const LocatorFilterEntry entry = m_locatorModel->data(index, ItemDataRoles::ResultItemRole).value(); - m_completionList->hide(); - m_fileLineEdit->clearFocus(); Q_ASSERT(entry.filter != nullptr); - entry.filter->accept(entry); + QString newText; + int selectionStart = -1; + int selectionLength = 0; + entry.filter->accept(entry, &newText, &selectionStart, &selectionLength); + if (newText.isEmpty()) { + m_completionList->hide(); + m_fileLineEdit->clearFocus(); + } else { + show(newText, selectionStart, selectionLength); + } } void LocatorWidget::show(const QString &text, int selectionStart, int selectionLength) diff --git a/src/plugins/coreplugin/locator/locatorwidget.h b/src/plugins/coreplugin/locator/locatorwidget.h index f6f2f6f4a4f..80b32192284 100644 --- a/src/plugins/coreplugin/locator/locatorwidget.h +++ b/src/plugins/coreplugin/locator/locatorwidget.h @@ -58,7 +58,7 @@ public: void show(const QString &text, int selectionStart = -1, int selectionLength = 0); - void setPlaceholderText(const QString &text); + void updatePlaceholderText(Command *command); private: void showPopup(); diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp index d6bfcab4ef3..16b14ba9767 100644 --- a/src/plugins/coreplugin/locator/opendocumentsfilter.cpp +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.cpp @@ -114,8 +114,12 @@ void OpenDocumentsFilter::refresh(QFutureInterface &future) QMetaObject::invokeMethod(this, "refreshInternally", Qt::BlockingQueuedConnection); } -void OpenDocumentsFilter::accept(LocatorFilterEntry selection) const +void OpenDocumentsFilter::accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) EditorManager::openEditor(selection.internalData.toString(), Id(), EditorManager::CanContainLineAndColumnNumber); } diff --git a/src/plugins/coreplugin/locator/opendocumentsfilter.h b/src/plugins/coreplugin/locator/opendocumentsfilter.h index 00622d1dbfd..8d140c86d79 100644 --- a/src/plugins/coreplugin/locator/opendocumentsfilter.h +++ b/src/plugins/coreplugin/locator/opendocumentsfilter.h @@ -45,7 +45,8 @@ public: OpenDocumentsFilter(); QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(LocatorFilterEntry selection) const override; + void accept(LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; public slots: diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp index 537dcc6da87..bc0584a0a56 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.cpp +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.cpp @@ -119,8 +119,13 @@ QList CppCurrentDocumentFilter::matchesFor( return betterEntries; } -void CppCurrentDocumentFilter::accept(Core::LocatorFilterEntry selection) const +void CppCurrentDocumentFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, + int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) IndexItem::Ptr info = qvariant_cast(selection.internalData); Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column()); } diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.h b/src/plugins/cpptools/cppcurrentdocumentfilter.h index 2a93cd3432e..d3452e26e10 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.h +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.h @@ -48,7 +48,8 @@ public: QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; private: diff --git a/src/plugins/cpptools/cpplocatorfilter.cpp b/src/plugins/cpptools/cpplocatorfilter.cpp index 084c4d5479d..f8bf53dd325 100644 --- a/src/plugins/cpptools/cpplocatorfilter.cpp +++ b/src/plugins/cpptools/cpplocatorfilter.cpp @@ -121,8 +121,12 @@ QList CppLocatorFilter::matchesFor( return betterEntries; } -void CppLocatorFilter::accept(Core::LocatorFilterEntry selection) const +void CppLocatorFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) IndexItem::Ptr info = qvariant_cast(selection.internalData); Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column()); } diff --git a/src/plugins/cpptools/cpplocatorfilter.h b/src/plugins/cpptools/cpplocatorfilter.h index 84ab9802ba6..1ce112b6626 100644 --- a/src/plugins/cpptools/cpplocatorfilter.h +++ b/src/plugins/cpptools/cpplocatorfilter.h @@ -43,7 +43,8 @@ public: QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; protected: diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index 61bf3d76b31..0428ee9c83d 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -137,8 +137,12 @@ QList HelpIndexFilter::matchesFor(QFutureInterface &links = HelpManager::linksForKeyword(key); diff --git a/src/plugins/help/helpindexfilter.h b/src/plugins/help/helpindexfilter.h index 701c37dbd39..1cf1f412975 100644 --- a/src/plugins/help/helpindexfilter.h +++ b/src/plugins/help/helpindexfilter.h @@ -45,7 +45,8 @@ public: void prepareSearch(const QString &entry) override; QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; Q_INVOKABLE QSet searchMatches(const QString &databaseFilePath, diff --git a/src/plugins/help/remotehelpfilter.cpp b/src/plugins/help/remotehelpfilter.cpp index 85684df6b71..6e176b9df66 100644 --- a/src/plugins/help/remotehelpfilter.cpp +++ b/src/plugins/help/remotehelpfilter.cpp @@ -143,8 +143,12 @@ QList RemoteHelpFilter::matchesFor(QFutureInterface matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; QByteArray saveState() const override; void restoreState(const QByteArray &state) override; diff --git a/src/plugins/macros/macrolocatorfilter.cpp b/src/plugins/macros/macrolocatorfilter.cpp index a631eafd546..b38ef531d8d 100644 --- a/src/plugins/macros/macrolocatorfilter.cpp +++ b/src/plugins/macros/macrolocatorfilter.cpp @@ -86,8 +86,12 @@ QList MacroLocatorFilter::matchesFor(QFutureInterface< return betterEntries; } -void MacroLocatorFilter::accept(Core::LocatorFilterEntry selection) const +void MacroLocatorFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) // Give the focus back to the editor Core::IEditor *editor = Core::EditorManager::currentEditor(); if (editor) diff --git a/src/plugins/macros/macrolocatorfilter.h b/src/plugins/macros/macrolocatorfilter.h index 442de6d3e24..f8dc6577537 100644 --- a/src/plugins/macros/macrolocatorfilter.h +++ b/src/plugins/macros/macrolocatorfilter.h @@ -45,7 +45,8 @@ public: QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; private: diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.cpp b/src/plugins/qmljstools/qmljsfunctionfilter.cpp index 036ba1a314d..7c00e6c9f02 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.cpp +++ b/src/plugins/qmljstools/qmljsfunctionfilter.cpp @@ -104,8 +104,12 @@ QList FunctionFilter::matchesFor( return betterEntries; } -void FunctionFilter::accept(Core::LocatorFilterEntry selection) const +void FunctionFilter::accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const { + Q_UNUSED(newText) + Q_UNUSED(selectionStart) + Q_UNUSED(selectionLength) const LocatorData::Entry entry = qvariant_cast(selection.internalData); Core::EditorManager::openEditorAt(entry.fileName, entry.line, entry.column); } diff --git a/src/plugins/qmljstools/qmljsfunctionfilter.h b/src/plugins/qmljstools/qmljsfunctionfilter.h index d696744694c..5d41c870d5d 100644 --- a/src/plugins/qmljstools/qmljsfunctionfilter.h +++ b/src/plugins/qmljstools/qmljsfunctionfilter.h @@ -42,7 +42,8 @@ public: QList matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &future) override; private: diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp index 13769727338..76a81522b18 100644 --- a/src/plugins/texteditor/linenumberfilter.cpp +++ b/src/plugins/texteditor/linenumberfilter.cpp @@ -88,8 +88,12 @@ QList LineNumberFilter::matchesFor(QFutureInterface matchesFor(QFutureInterface &future, const QString &entry) override; - void accept(Core::LocatorFilterEntry selection) const override; + void accept(Core::LocatorFilterEntry selection, + QString *newText, int *selectionStart, int *selectionLength) const override; void refresh(QFutureInterface &) override {} private: