SearchResult Class

(Core::SearchResult)

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

Header: #include <SearchResult>

Public Types

enum AddMode { AddSorted, AddOrdered }

Public Functions

QWidget *additionalReplaceWidget() const
int count() const
void setSearchAgainSupported(bool supported)
void setUserData(const QVariant &data)
QString textToReplace() const
QVariant userData() const

Public Slots

void addResult(const QString &fileName, int lineNumber, const QString &lineText, int searchTermStart, int searchTermLength, const QVariant &userData = QVariant())
void addResult(const QString &fileName, const QString &lineText, Search::TextRange mainRange, const QVariant &userData = QVariant())
void addResults(const QList<SearchResultItem> &items, AddMode mode)
void finishSearch(bool canceled)
void popup()
void restart()
void setSearchAgainEnabled(bool enabled)
void setTextToReplace(const QString &textToReplace)

Signals

void activated(const Core::SearchResultItem &item)
void cancelled()
void countChanged(int count)
void paused(bool paused)
void replaceButtonClicked(const QString &replaceText, const QList<Core::SearchResultItem> &checkedItems, bool preserveCase)
void requestEnabledCheck()
void searchAgainRequested()
void visibilityChanged(bool visible)

Detailed Description

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

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 Type Documentation

enum SearchResult::AddMode

Member Function Documentation

[signal] void SearchResult::activated(const Core::SearchResultItem &item)

Indicates that the user activated the search result item by double-clicking it, for example.

[slot] void SearchResult::addResult(const QString &fileName, int lineNumber, const QString &lineText, int searchTermStart, int searchTermLength, const QVariant &userData = QVariant())

Adds a single result line to the Search Results output pane.

fileName, lineNumber, and lineText are shown on the result line. searchTermStart and searchTermLength specify the region that should be visually marked (string position and length in lineText). You can attach arbitrary userData to the search result, which can be used, for example, when reacting to the signals of the search results for your search.

See also addResults().

[slot] void SearchResult::addResult(const QString &fileName, const QString &lineText, Search::TextRange mainRange, const QVariant &userData = QVariant())

[slot] void SearchResult::addResults(const QList<SearchResultItem> &items, AddMode mode)

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

See also addResult().

QWidget *SearchResult::additionalReplaceWidget() const

[signal] void SearchResult::cancelled()

int SearchResult::count() const

[signal] void SearchResult::countChanged(int count)

[slot] void SearchResult::finishSearch(bool canceled)

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

[signal] void SearchResult::paused(bool paused)

Opens the Search Results output pane with this search.

[signal] void SearchResult::replaceButtonClicked(const QString &replaceText, const QList<Core::SearchResultItem> &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, and the list of search result items that were selected by the user in checkedItems. The handler of this signal should apply the replace only on the selected items.

[signal] void SearchResult::requestEnabledCheck()

[slot] void SearchResult::restart()

Removes all search results.

[signal] void SearchResult::searchAgainRequested()

[slot] void SearchResult::setSearchAgainEnabled(bool enabled)

void SearchResult::setSearchAgainSupported(bool supported)

[slot] 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.

See also textToReplace().

void SearchResult::setUserData(const QVariant &data)

Attaches some random data to this search, that you can use later.

See also userData().

QString SearchResult::textToReplace() const

Returns the text that should replace the text in search results.

See also setTextToReplace().

QVariant SearchResult::userData() const

Returns the data that was attached to this search by calling setUserData().

See also setUserData().

[signal] void SearchResult::visibilityChanged(bool visible)