Locator: Add highlighting of the search text

Change-Id: Ia166e9667076e46770a754b626ceb28080139e79
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Serhii Moroz
2016-08-02 12:04:40 +03:00
parent 4f66adb9a2
commit 6ecb1c4018
22 changed files with 267 additions and 153 deletions

View File

@@ -65,10 +65,12 @@ void CMakeLocatorFilter::prepareSearch(const QString &entry)
if (!cmakeProject)
continue;
foreach (const QString &title, cmakeProject->buildTargetTitles()) {
if (title.contains(entry)) {
Core::LocatorFilterEntry entry(this, title, cmakeProject->projectFilePath().toString());
entry.extraInfo = FileUtils::shortNativePath(cmakeProject->projectFilePath());
m_result.append(entry);
const int index = title.indexOf(entry);
if (index >= 0) {
Core::LocatorFilterEntry filterEntry(this, title, cmakeProject->projectFilePath().toString());
filterEntry.extraInfo = FileUtils::shortNativePath(cmakeProject->projectFilePath());
filterEntry.highlightInfo = {index, entry.length()};
m_result.append(filterEntry);
}
}
}