The QPlaceSearchResult class is the base class for search results. 更多...
头: | #include <QPlaceSearchResult> |
qmake: | QT += location |
Since: | Qt 5.6 |
继承者: | QPlaceProposedSearchResult and QPlaceResult |
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 |
QSharedDataPointer<QPlaceSearchResultPrivate> | d_ptr |
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.
另请参阅 QPlaceResult .
Defines the type of search result
常量 | 值 | 描述 |
---|---|---|
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.
构造副本为 other
[虚拟]
QPlaceSearchResult::
~QPlaceSearchResult
()
Destroys the search result.
Returns an icon that can be used to represent the search result.
另请参阅 setIcon ().
Sets the icon of the search result to icon .
另请参阅 icon ().
Sets the title of the search result to title .
另请参阅 title ().
Returns the title of the search result. This string can be used to display the search result to the user.
另请参阅 setTitle ().
Returns the result type.
返回 true 若 other not equal to this search result, otherwise returns false.
赋值 other to this search result and returns a reference to this search result.
返回 true 若 other is equal to this search result, otherwise returns false.