The QPlaceSearchResult class is the base class for search results. More...
Header: | #include <QPlaceSearchResult> |
qmake: | QT += location |
Since: | Qt 5.6 |
Inherited By: |
enum | SearchResultType { UnknownSearchResult, PlaceResult, ProposedSearchResult } |
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 |
The QPlaceSearchResult class is the base class for search results.
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.
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. |
Constructs a new search result.
Constructs a copy of other
[virtual]
QPlaceSearchResult::~QPlaceSearchResult()Destroys the search result.
Returns an icon that can be used to represent the search result.
See also setIcon().
Sets the icon of the search result to icon.
See also icon().
Sets the title of the search result to title.
See also title().
Returns the title of the search result. This string can be used to display the search result to the user.
See also setTitle().
Returns the result type.
Returns true if other not equal to this search result, otherwise returns false.
Assigns other to this search result and returns a reference to this search result.
Returns true if other is equal to this search result, otherwise returns false.