- Qt 6.10
- Qt Location
- C++ Classes
- QPlaceSearchResult
- Qt 6.10.1 Reference Documentation

# QPlaceSearchResult Class

The QPlaceSearchResult class is the base class for search results. More...

Header: | `#include <QPlaceSearchResult>`
qmake: | `QT += location`
Inherited By: | QPlaceProposedSearchResult and QPlaceResult

- List of all members, including inherited members

## Public Types

enum | SearchResultType { UnknownSearchResult, PlaceResult, ProposedSearchResult }

## Public Functions

| QPlaceSearchResult()
| QPlaceSearchResult(const QPlaceSearchResult &other)
virtual | ~QPlaceSearchResult()
QPlaceIcon | icon() const
void | setIcon(const QPlaceIcon &icon)
void | setTitle(const QString &title)
QString | title() const
QPlaceSearchResult::SearchResultType | type() const
bool | operator!=(const QPlaceSearchResult &other) const
QPlaceSearchResult & | operator=(const QPlaceSearchResult &other)
bool | operator==(const QPlaceSearchResult &other) const

## Detailed Description

A list of search results can be retrieved from the QPlaceSearchReply after it has successfully completed the request. Common to all search results are the title and icon, which can be used to present the search result to the user.

The intended usage is that depending on the type, the search result can be converted to a more detailed subclass like so:

     if (result.type() == QPlaceSearchResult::PlaceResult) {
         QPlaceResult placeResult = result;
         qDebug() << placeResult.place().name();
         qDebug() << placeResult.place().location().coordinate();
         qDebug() << placeResult.distance();
     }

The implementation is handled in such a way that object slicing is not an issue. It is not expected that client applications or backend plugins instantiate a QPlaceSearchResult directly, but rather client applications simply convert to search result subclasses and backend plugins only instantiate subclasses.

See also QPlaceResult.

## Member Type Documentation

### enum QPlaceSearchResult::SearchResultType

Defines the type of search result

Constant | Value | Description
--- | --- | ---
`QPlaceSearchResult::UnknownSearchResult` | `0` | The contents of the search result are unknown.
`QPlaceSearchResult::PlaceResult` | `1` | The search result contains a place.
`QPlaceSearchResult::ProposedSearchResult` | `2` | The search result contains a proposed search which may be relevant.

## Member Function Documentation

### QPlaceSearchResult::QPlaceSearchResult()

Constructs a new search result.

### QPlaceSearchResult::QPlaceSearchResult(const QPlaceSearchResult &other)

Constructs a copy of other

### `[virtual noexcept]` QPlaceSearchResult::~QPlaceSearchResult()

Destroys the search result.

### QPlaceIcon QPlaceSearchResult::icon() const

Returns an icon that can be used to represent the search result.

See also setIcon().

### void QPlaceSearchResult::setIcon(const QPlaceIcon &icon)

Sets the icon of the search result to icon.

See also icon().

### void QPlaceSearchResult::setTitle(const QString &title)

Sets the title of the search result to title.

See also title().

### QString QPlaceSearchResult::title() const

Returns the title of the search result. This string can be used to display the search result to the user.

See also setTitle().

### QPlaceSearchResult::SearchResultType QPlaceSearchResult::type() const

Returns the result type.

### bool QPlaceSearchResult::operator!=(const QPlaceSearchResult &other) const

Returns true if other not equal to this search result, otherwise returns false.

### QPlaceSearchResult &QPlaceSearchResult::operator=(const QPlaceSearchResult &other)

Assigns other to this search result and returns a reference to this search result.

### bool QPlaceSearchResult::operator==(const QPlaceSearchResult &other) const

Returns true if other is equal to this search result, otherwise returns false.