Reuse FileSearchResultList

Change-Id: I2a20167faf78fcfa3b4bf392a42e0a72d92cd68e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-09-06 16:53:57 +02:00
parent d8fcaf0a73
commit dbfdd334b5
5 changed files with 8 additions and 9 deletions

View File

@@ -6304,8 +6304,8 @@ void TextEditorWidgetPrivate::searchResultsReady(int beginIndex, int endIndex)
{
QVector<SearchResult> results;
for (int index = beginIndex; index < endIndex; ++index) {
const QList<Utils::FileSearchResult> resultList = m_searchWatcher->resultAt(index);
for (Utils::FileSearchResult result : resultList) {
const FileSearchResultList resultList = m_searchWatcher->resultAt(index);
for (FileSearchResult result : resultList) {
const QTextBlock &block = q->document()->findBlockByNumber(result.lineNumber - 1);
const int matchStart = block.position() + result.matchStart;
QTextCursor cursor(block);
@@ -6360,9 +6360,9 @@ void TextEditorWidgetPrivate::highlightSearchResultsInScrollBar()
adjustScrollBarRanges();
m_searchWatcher = new QFutureWatcher<FileSearchResultList>();
connect(m_searchWatcher, &QFutureWatcher<Utils::FileSearchResultList>::resultsReadyAt,
connect(m_searchWatcher, &QFutureWatcher<FileSearchResultList>::resultsReadyAt,
this, &TextEditorWidgetPrivate::searchResultsReady);
connect(m_searchWatcher, &QFutureWatcher<Utils::FileSearchResultList>::finished,
connect(m_searchWatcher, &QFutureWatcher<FileSearchResultList>::finished,
this, &TextEditorWidgetPrivate::searchFinished);
m_searchWatcher->setPendingResultsLimit(10);