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:
Eike Ziller
2017-05-29 12:50:20 +02:00
parent 19a47fed29
commit 247639d9c3
36 changed files with 166 additions and 95 deletions

View File

@@ -83,8 +83,12 @@ QList<Core::LocatorFilterEntry> 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<CMakeProject *>(
Utils::findOrDefault(SessionManager::projects(), [selection](Project *p) {

View File

@@ -40,7 +40,8 @@ public:
void prepareSearch(const QString &entry) override;
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: