QPlaceSearchResult Class

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

Header: #include <QPlaceSearchResult>
qmake: QT += location
Since: Qt 5.6
Inherited By:

QPlaceProposedSearchResult and QPlaceResult

This class was introduced in Qt 5.6.

Public Types

enum SearchResultType { UnknownSearchResult, PlaceResult, ProposedSearchResult }

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

ConstantValueDescription
QPlaceSearchResult::UnknownSearchResult0The contents of the search result are unknown.
QPlaceSearchResult::PlaceResult1The search result contains a place.
QPlaceSearchResult::ProposedSearchResult2The search result contains a proposed search which may be relevant.