forked from qt-creator/qt-creator
Core: Fix item view find
...when there is only one matching item and we are starting search from there. Change-Id: Icfffd37d9330c83058fb81356762e72b183f24e8 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -203,11 +203,18 @@ IFindSupport::Result ItemViewFind::find(const QString &searchTxt,
|
||||
index, d->m_role).toString();
|
||||
if (d->m_view->model()->flags(index) & Qt::ItemIsSelectable
|
||||
&& (index.row() != currentRow || index.parent() != currentIndex.parent())
|
||||
&& text.indexOf(searchExpr) != -1)
|
||||
&& text.indexOf(searchExpr) != -1) {
|
||||
resultIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
index = followingIndex(index, backward, &stepWrapped);
|
||||
} while (!resultIndex.isValid() && index.isValid() && index != currentIndex);
|
||||
if (index == currentIndex) { // we're back where we started
|
||||
if (d->m_view->model()->data(index, d->m_role).toString().indexOf(searchExpr) != -1)
|
||||
resultIndex = index;
|
||||
break;
|
||||
}
|
||||
} while (index.isValid());
|
||||
|
||||
if (resultIndex.isValid()) {
|
||||
d->m_view->setCurrentIndex(resultIndex);
|
||||
|
Reference in New Issue
Block a user