QPlaceSearchResult Class

Die Klasse QPlaceSearchResult ist die Basisklasse für Suchergebnisse. Mehr...

Header: #include <QPlaceSearchResult>
qmake: QT += location
Inherited By:

QPlaceProposedSearchResult and QPlaceResult

Öffentliche Typen

enum SearchResultType { UnknownSearchResult, PlaceResult, ProposedSearchResult }

Öffentliche Funktionen

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

Detaillierte Beschreibung

Eine Liste von Suchergebnissen kann von QPlaceSearchReply abgerufen werden, nachdem es die Anfrage erfolgreich abgeschlossen hat. Allen Suchergebnissen gemeinsam sind title und icon, die dazu verwendet werden können, dem Nutzer das Suchergebnis zu präsentieren.

Die beabsichtigte Verwendung besteht darin, dass das Suchergebnis je nach type in eine detailliertere Unterklasse umgewandelt werden kann, z. B. so:

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

Die Implementierung wird so gehandhabt, dass Objekt-Slicing kein Problem darstellt. Es wird nicht erwartet, dass Client-Anwendungen oder Backend-Plugins ein QPlaceSearchResult direkt instanziieren, sondern Client-Anwendungen konvertieren einfach in Suchergebnis-Unterklassen und Backend-Plugins instanziieren nur Unterklassen.

Siehe auch QPlaceResult.

Member-Typ Dokumentation

enum QPlaceSearchResult::SearchResultType

Definiert die Art des Suchergebnisses

KonstanteWertBeschreibung
QPlaceSearchResult::UnknownSearchResult0Der Inhalt des Suchergebnisses ist unbekannt.
QPlaceSearchResult::PlaceResult1Das Suchergebnis enthält einen Ort.
QPlaceSearchResult::ProposedSearchResult2Das Suchergebnis enthält einen Suchvorschlag, der relevant sein kann.

Dokumentation der Mitgliedsfunktionen

QPlaceSearchResult::QPlaceSearchResult()

Konstruiert ein neues Suchergebnis.

QPlaceSearchResult::QPlaceSearchResult(const QPlaceSearchResult &other)

Konstruiert eine Kopie von other

[virtual noexcept] QPlaceSearchResult::~QPlaceSearchResult()

Zerstört das Suchergebnis.

QPlaceIcon QPlaceSearchResult::icon() const

Gibt ein Symbol zurück, das zur Darstellung des Suchergebnisses verwendet werden kann.

Siehe auch setIcon().

void QPlaceSearchResult::setIcon(const QPlaceIcon &icon)

Setzt das Symbol des Suchergebnisses auf icon.

Siehe auch icon().

void QPlaceSearchResult::setTitle(const QString &title)

Setzt den Titel des Suchergebnisses auf title.

Siehe auch title().

QString QPlaceSearchResult::title() const

Gibt den Titel des Suchergebnisses zurück. Diese Zeichenfolge kann verwendet werden, um dem Benutzer das Suchergebnis anzuzeigen.

Siehe auch setTitle().

QPlaceSearchResult::SearchResultType QPlaceSearchResult::type() const

Gibt den Ergebnistyp zurück.

bool QPlaceSearchResult::operator!=(const QPlaceSearchResult &other) const

Gibt true zurück, wenn other nicht mit diesem Suchergebnis übereinstimmt, andernfalls wird false zurückgegeben.

QPlaceSearchResult &QPlaceSearchResult::operator=(const QPlaceSearchResult &other)

Weist diesem Suchergebnis other zu und gibt einen Verweis auf dieses Suchergebnis zurück.

bool QPlaceSearchResult::operator==(const QPlaceSearchResult &other) const

Gibt true zurück, wenn other mit diesem Suchergebnis übereinstimmt, andernfalls wird false zurückgegeben.

© 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.