QPlaceResult Class
QPlaceResult 类表示包含一个地点的搜索结果。更多
Header: | #include <QPlaceResult> |
qmake: | QT += location |
Inherits: | QPlaceSearchResult |
公共函数
QPlaceResult() | |
QPlaceResult(const QPlaceSearchResult &other) | |
virtual | ~QPlaceResult() |
qreal | distance() const |
bool | isSponsored() const |
QPlace | place() const |
void | setDistance(qreal distance) |
void | setPlace(const QPlace &place) |
void | setSponsored(bool sponsored) |
详细说明
PlaceResult 包含从搜索请求中心到该地点的距离、该地点的实例以及该结果是赞助商搜索还是有机搜索的指示。
其用途是将QPlaceSearchResult 转换成类似的 QPlaceResult:
if(result.type()==QPlaceSearchResult::PlaceResult) { QPlaceResultplaceResult=result; qDebug() << placeResult.place().name(); qDebug() << placeResult.place().location().coordinate(); qDebug() << placeResult.distance(); }
在执行过程中,对象分片不是问题。
另请参见 QPlaceSearchResult 。
成员函数文档
QPlaceResult::QPlaceResult()
构造一个新的位置结果对象。
QPlaceResult::QPlaceResult(const QPlaceSearchResult &other)
如果可能,构建other 的副本,否则构建默认的位置结果。
[virtual noexcept]
QPlaceResult::~QPlaceResult()
毁灭者
qreal QPlaceResult::distance() const
返回地点到搜索中心的距离。只有在搜索请求包含一个搜索中心的搜索区域时,该字段才会相关。否则,距离值为 NaN,表示距离未定义。距离的默认值是 NaN。
另请参阅 setDistance()。
bool QPlaceResult::isSponsored() const
如果结果是赞助结果,则返回 true。
另请参阅 setSponsored()。
QPlace QPlaceResult::place() const
返回搜索结果的位置。
另请参阅 setPlace()。
void QPlaceResult::setDistance(qreal distance)
设置搜索结果在搜索中心的位置distance 。
另请参见 distance().
void QPlaceResult::setPlace(const QPlace &place)
设置该结果指向的place 。
另请参阅 place()。
void QPlaceResult::setSponsored(bool sponsored)
设置结果是否为sponsored 结果。
另请参阅 isSponsored() 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.