- Extending Qt Creator Manual
- QtCreator
- SearchResult
- Extending Qt Creator Manual 10.0.1

# SearchResult Class

class Core::SearchResult

The SearchResult class reports user interaction, such as the activation of a search result item. More...

Header: | #include <coreplugin/find/searchresultwindow.h>

- List of all members, including inherited members

## Public Functions

void | addResults(const int &items, int mode)
void | countChanged(int count)
void | finishSearch(bool canceled, const QString &reason = ...)
void | paused(bool paused)
void | popup()
void | replaceButtonClicked(const QString &replaceText, const int &checkedItems, bool preserveCase)
void | requestEnabledCheck()
void | restart()
void | searchAgainRequested()
void | setReplaceEnabled(bool enabled)
void | setSearchAgainEnabled(bool enabled)
void | setTextToReplace(const QString &textToReplace)
void | visibilityChanged(bool visible)

## Detailed Description

Whenever a new search is initiated via startNewSearch, an instance of this class is returned to provide the initiator with the hooks for handling user interaction.

## Member Function Documentation

### void SearchResult::addResults(const int &items, int mode)

Adds the search result items to the Search Results output pane using mode.

See also addResult().

### void SearchResult::countChanged(int count)

This signal is emitted when the number of search hits changes to count.

### void SearchResult::finishSearch(bool canceled, const QString &reason = ...)

Notifies the Search Results output pane that the current search has been canceled, and the UI should reflect that.

### void SearchResult::paused(bool paused)

This signal is emitted when the search status is set to paused.

### void SearchResult::popup()

Opens the Search Results output pane with this search.

### void SearchResult::replaceButtonClicked(const QString &replaceText, const int &checkedItems, bool preserveCase)

Indicates that the user initiated a text replace by selecting Replace All, for example.

The signal reports the text to use for replacement in replaceText, the list of search result items that were selected by the user in checkedItems, and whether a search and replace should preserve the case of the replaced strings in preserveCase. The handler of this signal should apply the replace only on the selected items.

### void SearchResult::requestEnabledCheck()

This signal is emitted when the enabled status of search results is requested.

### void SearchResult::restart()

Removes all search results.

### void SearchResult::searchAgainRequested()

This signal is emitted when the Search Again button is selected.

### void SearchResult::setReplaceEnabled(bool enabled)

Sets whether replace is enabled and can be triggered by the user.

### void SearchResult::setSearchAgainEnabled(bool enabled)

Sets whether the Seach Again button is enabled to enabled.

### void SearchResult::setTextToReplace(const QString &textToReplace)

Sets the value in the UI element that allows the user to type the text that should replace text in search results to textToReplace.

### void SearchResult::visibilityChanged(bool visible)

This signal is emitted when the visibility of the search results changes to visible.