SearchResultWindow Class

class Core::SearchResultWindow

The SearchResultWindow class is the implementation of a commonly shared Search Results output pane. More...

Header: #include <coreplugin/find/searchresultwindow.h>
Inherits: Core::IOutputPane

Public Types

enum PreserveCaseMode { PreserveCaseEnabled, PreserveCaseDisabled }
enum SearchMode { SearchOnly, SearchAndReplace }

Detailed Description

Whenever you want to show the user a list of search results, or want to present UI for a global search and replace, use the single instance of this class.

In addition to being an implementation of an output pane, the SearchResultWindow has functions and enums that enable other plugins to show their search results and hook into the user actions for selecting an entry and performing a global replace.

Whenever you start a search, call startNewSearch(SearchMode) to initialize the Search Results output pane. The parameter determines if the GUI for replacing should be shown. The function returns a SearchResult object that is your hook into the signals from user interaction for this search. When you produce search results, call addResults() or addResult() to add them to the Search Results output pane. After the search has finished call finishSearch() to inform the Search Results output pane about it.

You will get activated() signals via your SearchResult instance when the user selects a search result item. If you started the search with the SearchAndReplace option, the replaceButtonClicked() signal is emitted when the user requests a replace.

Member Type Documentation

enum SearchResultWindow::PreserveCaseMode

This enum type specifies whether a search and replace should preserve the case of the replaced strings:

ConstantValueDescription
Core::SearchResultWindow::PreserveCaseEnabled0The case is preserved when replacings strings.
Core::SearchResultWindow::PreserveCaseDisabled1The given case is used when replacing strings.

enum SearchResultWindow::SearchMode

This enum type specifies whether a search should show the replace UI or not:

ConstantValueDescription
Core::SearchResultWindow::SearchOnly0The search does not support replace.
Core::SearchResultWindow::SearchAndReplace1The search supports replace, so show the UI for it.