forked from qt-creator/qt-creator
Remove 1-1 dependency between locator and locator input widget
Add possibility for filters to set a new search text when accepting an entry. Move placeholder text update from locator manager to widget. Propagate filter update through signal-slot connection instead of directly. LocatorManager::show is the only place left that directly references the locator widget. Change-Id: Id61354d9f166c2af8c9d5528ad8998c7c6b8e1ab Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -119,8 +119,13 @@ QList<Core::LocatorFilterEntry> 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<CppTools::IndexItem::Ptr>(selection.internalData);
|
||||
Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column());
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ public:
|
||||
|
||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &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<void> &future) override;
|
||||
|
||||
private:
|
||||
|
||||
@@ -121,8 +121,12 @@ QList<Core::LocatorFilterEntry> 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<IndexItem::Ptr>(selection.internalData);
|
||||
Core::EditorManager::openEditorAt(info->fileName(), info->line(), info->column());
|
||||
}
|
||||
|
||||
@@ -43,7 +43,8 @@ public:
|
||||
|
||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &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<void> &future) override;
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user