In questa pagina

QGeoLocation Class

La classe QGeoLocation rappresenta le informazioni di base relative a una posizione. Per saperne di più...

Intestazione: #include <QGeoLocation>
CMake: find_package(Qt6 REQUIRED COMPONENTS Positioning)
target_link_libraries(mytarget PRIVATE Qt6::Positioning)
qmake: QT += positioning

Funzioni pubbliche

QGeoLocation()
QGeoLocation(const QGeoLocation &other)
(since 6.2) QGeoLocation(QGeoLocation &&other)
~QGeoLocation()
QGeoAddress address() const
(since 6.2) QGeoShape boundingShape() const
QGeoCoordinate coordinate() const
QVariantMap extendedAttributes() const
bool isEmpty() const
void setAddress(const QGeoAddress &address)
(since 6.2) void setBoundingShape(const QGeoShape &boundingShape)
void setCoordinate(const QGeoCoordinate &coordinate)
void setExtendedAttributes(const QVariantMap &data)
(since 6.2) void swap(QGeoLocation &other)
(since 6.2) QGeoLocation &operator=(QGeoLocation &&other)
QGeoLocation &operator=(const QGeoLocation &other)
size_t qHash(const QGeoLocation &location, size_t seed = 0)
bool operator!=(const QGeoLocation &lhs, const QGeoLocation &rhs)
bool operator==(const QGeoLocation &lhs, const QGeoLocation &rhs)

Descrizione dettagliata

Un oggetto QGeoLocation è costituito da una coordinata e dall'indirizzo corrispondente, insieme a una forma di delimitazione opzionale, che rappresenta l'area consigliata da visualizzare quando si visualizza la posizione.

Documentazione delle funzioni membro

QGeoLocation::QGeoLocation()

Crea un nuovo oggetto posizione.

QGeoLocation::QGeoLocation(const QGeoLocation &other)

Crea una copia di other

[constexpr noexcept default, since 6.2] QGeoLocation::QGeoLocation(QGeoLocation &&other)

Crea un oggetto di geolocalizzazione trasferendolo da other.

Nota: l'oggetto QGeoLocation da cui si è effettuato lo spostamento può solo essere distrutto o assegnato. L'effetto della chiamata a funzioni diverse dal distruttore o da uno degli operatori di assegnazione è indefinito.

Questa funzione è stata introdotta in Qt 6.2.

[noexcept] QGeoLocation::~QGeoLocation()

Elimina l'oggetto posizione.

QGeoAddress QGeoLocation::address() const

Restituisce l'indirizzo della posizione.

Vedi anche setAddress().

[since 6.2] QGeoShape QGeoLocation::boundingShape() const

Restituisce una forma di delimitazione che rappresenta l'area consigliata da visualizzare quando si osserva questa posizione.

Ad esempio, la posizione di un edificio può avere un'area centrata attorno all'edificio stesso, ma tale area è sufficientemente ampia da mostrare il contesto geografico circostante.

Nota: questo metodo è stato introdotto in Qt6 in sostituzione del metodo `boundingBox()`. Restituisce un oggetto ` QGeoShape ` anziché un oggetto ` QGeoRectangle`. Utilizzare ` QGeoShape::boundingGeoRectangle()` per ottenere un oggetto `bounding QGeoRectangle ` per la forma.

Questa funzione è stata introdotta in Qt 6.2.

Vedi anche ` setBoundingShape()`.

QGeoCoordinate QGeoLocation::coordinate() const

Restituisce le coordinate della posizione.

Vedi anche setCoordinate().

QVariantMap QGeoLocation::extendedAttributes() const

Restituisce gli attributi estesi associati a questa posizione. Gli attributi estesi dipendono dal backend e possono dipendere dalla posizione.

Vedi anche setExtendedAttributes().

bool QGeoLocation::isEmpty() const

Restituisce " true " se la coordinata della posizione è " invalid" e tutti gli altri campi relativi alla posizione sono vuoti. In caso contrario, restituisce " false".

void QGeoLocation::setAddress(const QGeoAddress &address)

Imposta l'address e della posizione.

Vedi anche address().

[since 6.2] void QGeoLocation::setBoundingShape(const QGeoShape &boundingShape)

Imposta l'boundingShape e della posizione.

Questa funzione è stata introdotta in Qt 6.2.

Vedi anche boundingShape().

void QGeoLocation::setCoordinate(const QGeoCoordinate &coordinate)

Imposta l'coordinate e della posizione.

Vedi anche coordinate().

void QGeoLocation::setExtendedAttributes(const QVariantMap &data)

Imposta gli attributi estesi della posizione con i parametri specificati in data.

Vedi anche extendedAttributes().

[noexcept, since 6.2] void QGeoLocation::swap(QGeoLocation &other)

Scambia questa posizione con other. Questa operazione è molto veloce e non fallisce mai.

Questa funzione è stata introdotta in Qt 6.2.

[noexcept, since 6.2] QGeoLocation &QGeoLocation::operator=(QGeoLocation &&other)

Sposta l'oggetto other in questa posizione e restituisce un riferimento a tale posizione.

Nota: L'oggetto QGeoLocation da cui è stato effettuato lo spostamento può solo essere distrutto o assegnato. L'effetto della chiamata a funzioni diverse dal distruttore o da uno degli operatori di assegnazione è indefinito.

Questa funzione è stata introdotta in Qt 6.2.

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

Assegna “ other ” a questa posizione e restituisce un riferimento a tale posizione.

Elementi correlati non membri

[noexcept] size_t qHash(const QGeoLocation &location, size_t seed = 0)

Restituisce il valore hash dell'oggetto " location", utilizzando l'algoritmo seed per il calcolo.

Nota: l'hash non tiene conto degli attributi estesi. Ciò significa che due oggetti di geolocalizzazione che differiscono solo per gli attributi estesi forniranno hash simili.

bool operator!=(const QGeoLocation &lhs, const QGeoLocation &rhs)

Restituisce " true " se l'indirizzo lhs non è uguale a rhs; in caso contrario, restituisce " false".

bool operator==(const QGeoLocation &lhs, const QGeoLocation &rhs)

Restituisce " true " se l'indirizzo lhs corrisponde a rhs; in caso contrario, restituisce " 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.