diff options
Diffstat (limited to 'src/plugins/coreplugin/find/searchresulttreeview.cpp')
-rw-r--r-- | src/plugins/coreplugin/find/searchresulttreeview.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/find/searchresulttreeview.cpp b/src/plugins/coreplugin/find/searchresulttreeview.cpp index 6a9b7067bf4..0ca09fcefd1 100644 --- a/src/plugins/coreplugin/find/searchresulttreeview.cpp +++ b/src/plugins/coreplugin/find/searchresulttreeview.cpp @@ -78,6 +78,21 @@ void SearchResultTreeView::addResults(const QList<SearchResultItem> &items, Sear } } +void SearchResultTreeView::keyPressEvent(QKeyEvent *event) +{ + if ((event->key() == Qt::Key_Return + || event->key() == Qt::Key_Enter) + && event->modifiers() == 0 + && currentIndex().isValid() + && state() != QAbstractItemView::EditingState) { + const SearchResultItem item + = model()->data(currentIndex(), ItemDataRoles::ResultItemRole).value<SearchResultItem>(); + emit jumpToSearchResult(item); + return; + } + TreeView::keyPressEvent(event); +} + void SearchResultTreeView::emitJumpToSearchResult(const QModelIndex &index) { if (model()->data(index, ItemDataRoles::IsGeneratedRole).toBool()) |