QPlaceSearchResult Class
QPlaceSearchResult クラスは、検索結果の基底クラスです。詳細...
| Header: | #include <QPlaceSearchResult> |
| qmake: | QT += location |
| 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 |
詳細な説明
リクエストが正常に完了した後、QPlaceSearchReply から検索結果の一覧を取得できます。すべての検索結果に共通するtitle とicon は、検索結果をユーザーに表示するために使用できます。
想定される使用方法としては、type に応じて、検索結果を次のように、より詳細なサブクラスに変換することができます:
if(result.type()==QPlaceSearchResult::PlaceResult) {
QPlaceResult placeResult=result;
qDebug() << placeResult.place().name();
qDebug() << placeResult.place().location().coordinate();
qDebug() << placeResult.distance();
}この実装では、オブジェクトのスライシングが問題にならないように処理されています。クライアントアプリケーションやバックエンドプラグインが QPlaceSearchResult を直接インスタンス化することは想定されておらず、クライアントアプリケーションは単に検索結果のサブクラスに変換し、バックエンドプラグインはサブクラスのみをインスタンス化することになっています。
QPlaceResultも参照してください 。
メンバ型のドキュメント
enum QPlaceSearchResult::SearchResultType
検索結果のタイプを定義します
| 定数 | 値 | 説明 |
|---|---|---|
QPlaceSearchResult::UnknownSearchResult | 0 | 検索結果の内容は不明です。 |
QPlaceSearchResult::PlaceResult | 1 | 検索結果に場所が含まれています。 |
QPlaceSearchResult::ProposedSearchResult | 2 | 検索結果に、関連性があると思われる検索候補が含まれています。 |
メンバー関数のドキュメント
QPlaceSearchResult::QPlaceSearchResult()
新しい検索結果を生成します。
QPlaceSearchResult::QPlaceSearchResult(const QPlaceSearchResult &other)
のコピーを作成します。other
[virtual noexcept] QPlaceSearchResult::~QPlaceSearchResult()
検索結果を削除します。
QPlaceIcon QPlaceSearchResult::icon() const
検索結果を表現するために使用できるアイコンを返します。
setIcon()も参照してください 。
void QPlaceSearchResult::setIcon(const QPlaceIcon &icon)
検索結果のアイコンをicon に設定します。
icon()も参照してください 。
void QPlaceSearchResult::setTitle(const QString &title)
検索結果のタイトルを「title 」に設定します。
title()も参照してください 。
QString QPlaceSearchResult::title() const
検索結果のタイトルを返します。この文字列は、検索結果をユーザーに表示するために使用できます。
setTitle()も参照してください 。
QPlaceSearchResult::SearchResultType QPlaceSearchResult::type() const
結果の型を返します。
bool QPlaceSearchResult::operator!=(const QPlaceSearchResult &other) const
other がこの検索結果と一致しない場合は true を返し、一致する場合は false を返します。
QPlaceSearchResult &QPlaceSearchResult::operator=(const QPlaceSearchResult &other)
この検索結果にother を割り当て、この検索結果への参照を返します。
bool QPlaceSearchResult::operator==(const QPlaceSearchResult &other) const
other がこの検索結果と一致する場合はtrueを返し、そうでない場合はfalseを返します。
© 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.