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) {
QPlaceResult placeResult=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 となり、距離が未定義であることを示します。distance のデフォルト値は 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()も参照してください 。
© 2026 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.