Auf dieser Seite

QPlaceResult Class

Die Klasse „QPlaceResult“ stellt ein Suchergebnis dar, das einen Ort enthält. Mehr...

Header: #include <QPlaceResult>
qmake: QT += location
Inherits: QPlaceSearchResult

Öffentliche Funktionen

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)

Ausführliche Beschreibung

Das „PlaceResult“-Objekt enthält die Entfernung des Ortes vom Mittelpunkt der Suchanfrage, eine Instanz des Ortes sowie die Angabe, ob es sich um ein gesponsertes oder ein organisches Ergebnis handelt.

Die beabsichtigte Verwendung sieht vor, dass ein „ QPlaceSearchResult “ wie folgt in ein „QPlaceResult“ umgewandelt werden kann:

if (result.type()== QPlaceSearchResult::PlaceResult) {
    QPlaceResult placeResult = result;
    qDebug() << placeResult.place().name();
    qDebug() << placeResult.place().location().coordinate();
    qDebug() << placeResult.distance();
}

Die Implementierung ist so gestaltet, dass das „Object Slicing“ kein Problem darstellt.

Siehe auch QPlaceSearchResult.

Dokumentation zu Mitgliedsfunktionen

QPlaceResult::QPlaceResult()

Erstellt ein neues Ergebnisobjekt für einen Ort.

QPlaceResult::QPlaceResult(const QPlaceSearchResult &other)

Erstellt, sofern möglich, eine Kopie von „ other “; andernfalls wird ein Standard-Ergebnis erstellt.

[virtual noexcept] QPlaceResult::~QPlaceResult()

Destruktor.

qreal QPlaceResult::distance() const

Gibt die Entfernung des Ortes zum Suchzentrum zurück. Dieses Feld ist nur relevant, wenn die Suchanfrage einen Suchbereich mit einem Suchzentrum enthielt. Andernfalls ist die Entfernung „NaN“, was auf eine undefinierte Entfernung hinweist. Der Standardwert für die Entfernung ist „NaN“.

Siehe auch „ setDistance()“.

bool QPlaceResult::isSponsored() const

Gibt „true“ zurück, wenn es sich bei dem Ergebnis um ein gesponsertes Ergebnis handelt.

Siehe auch „ setSponsored()“.

QPlace QPlaceResult::place() const

Gibt die Position des Suchergebnisses zurück.

Siehe auch „ setPlace()“.

void QPlaceResult::setDistance(qreal distance)

Legen Sie die „ distance “ des Standorts des Suchergebnisses von einem Suchzentrum aus fest.

Siehe auch „ distance()“.

void QPlaceResult::setPlace(const QPlace &place)

Legt die „ place “ fest, auf die sich dieses Ergebnis bezieht.

Siehe auch place().

void QPlaceResult::setSponsored(bool sponsored)

Legt fest, ob das Ergebnis ein „ sponsored “-Ergebnis ist oder nicht.

Siehe auch ` 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.