In questa pagina

QGeoAddress Class

La classe QGeoAddress rappresenta l'indirizzo di un QGeoLocation. Per saperne di più...

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

Funzioni pubbliche

QGeoAddress()
QGeoAddress(const QGeoAddress &other)
(since 6.2) QGeoAddress(QGeoAddress &&other)
~QGeoAddress()
QString city() const
void clear()
QString country() const
QString countryCode() const
QString county() const
QString district() const
bool isEmpty() const
bool isTextGenerated() const
QString postalCode() const
void setCity(const QString &city)
void setCountry(const QString &country)
void setCountryCode(const QString &countryCode)
void setCounty(const QString &county)
void setDistrict(const QString &district)
void setPostalCode(const QString &postalCode)
void setState(const QString &state)
void setStreet(const QString &street)
(since 6.2) void setStreetNumber(const QString &streetNumber)
void setText(const QString &text)
QString state() const
QString street() const
(since 6.2) QString streetNumber() const
(since 6.2) void swap(QGeoAddress &other)
QString text() const
(since 6.2) QGeoAddress &operator=(QGeoAddress &other)
QGeoAddress &operator=(const QGeoAddress &address)
size_t qHash(const QGeoAddress &address, size_t seed = 0)
bool operator!=(const QGeoAddress &lhs, const QGeoAddress &rhs)
bool operator==(const QGeoAddress &lhs, const QGeoAddress &rhs)

Descrizione dettagliata

Gli attributi dell'indirizzo sono normalizzati secondo la nomenclatura statunitense e possono essere mappati ai livelli locali (ad esempio, "State" corrisponde a "Bundesland" in Germania).

L'indirizzo contiene un oggetto text() a scopo di visualizzazione e proprietà aggiuntive per accedere ai componenti di un indirizzo:

Documentazione delle funzioni membro

QGeoAddress::QGeoAddress()

Costruttore predefinito.

QGeoAddress::QGeoAddress(const QGeoAddress &other)

Crea una copia di other.

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

Crea un oggetto geoaddress trasferendo i dati da un oggetto other.

Nota: l'oggetto `QGeoAddress` da cui è stato effettuato il trasferimento 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] QGeoAddress::~QGeoAddress()

Elimina questo indirizzo.

QString QGeoAddress::city() const

Restituisce il nome della città.

Vedi anche setCity().

void QGeoAddress::clear()

Cancella tutti i campi dati dell'indirizzo.

QString QGeoAddress::country() const

Restituisce il nome del Paese.

Vedi anche setCountry().

QString QGeoAddress::countryCode() const

Restituisce il codice paese secondo lo standard ISO 3166-1 alpha-3

Vedi anche setCountryCode().

QString QGeoAddress::county() const

Restituisce la contea. La contea è considerata la seconda suddivisione al di sotto del paese.

Vedi anche setCounty().

QString QGeoAddress::district() const

Restituisce il distretto. Il distretto è considerato la suddivisione di livello inferiore rispetto alla città.

Vedi anche setDistrict().

bool QGeoAddress::isEmpty() const

Restituisce se questo indirizzo è vuoto. Un indirizzo è considerato vuoto se tutti i suoi campi sono vuoti.

bool QGeoAddress::isTextGenerated() const

Restituisce true se QGeoAddress::text() viene generato automaticamente dagli elementi di indirizzo, altrimenti restituisce false se text() è stato assegnato esplicitamente.

Vedi anche text() e setText().

QString QGeoAddress::postalCode() const

Restituisce il codice postale.

Vedi anche setPostalCode().

void QGeoAddress::setCity(const QString &city)

Imposta il parametro " city".

Vedi anche city().

void QGeoAddress::setCountry(const QString &country)

Imposta il nome dell’ country.

Vedi anche country().

void QGeoAddress::setCountryCode(const QString &countryCode)

Imposta l'countryCode e in base alla norma ISO 3166-1 alfa-3

Vedi anche countryCode().

void QGeoAddress::setCounty(const QString &county)

Imposta il parametro " county".

Vedi anche county().

void QGeoAddress::setDistrict(const QString &district)

Imposta il parametro " district".

Vedi anche district().

void QGeoAddress::setPostalCode(const QString &postalCode)

Imposta il parametro “ postalCode ”.

Vedi anche postalCode().

void QGeoAddress::setState(const QString &state)

Imposta la proprietà ` state`.

Vedi anche state().

void QGeoAddress::setStreet(const QString &street)

Imposta il nome della via su street.

Nota: prima di Qt6 questo campo poteva contenere anche elementi quali il numero civico, il nome dell'edificio o qualsiasi altra informazione utile a distinguere un indirizzo da un altro. Ora, per impostare questi dati, utilizzare setStreetNumber().

Vedi anche ` street()` e ` setStreetNumber()`.

[since 6.2] void QGeoAddress::setStreetNumber(const QString &streetNumber)

Imposta il numero civico su streetNumber.

Può contenere anche elementi quali il numero di unità, il nome dell'edificio o qualsiasi altra informazione che possa essere utilizzata per distinguere un indirizzo da un altro.

Nota: prima di Qt 6 questa informazione veniva impostata tramite il metodo setStreet().

Questa funzione è stata introdotta in Qt 6.2.

Vedi anche streetNumber() e setStreet().

void QGeoAddress::setText(const QString &text)

Se text non è vuoto, assegna esplicitamente text come stringa da restituire da text(). isTextGenerated() restituirà false.

Se text è vuoto, indica che text() deve essere generato automaticamente dagli elementi address. isTextGenerated() restituirà true.

Vedi anche text().

QString QGeoAddress::state() const

Restituisce lo stato. Lo stato è considerato la prima suddivisione al di sotto del paese.

Vedi anche setState().

QString QGeoAddress::street() const

Restituisce il nome della via.

Nota: prima di Qt6 questo poteva contenere anche elementi quali il numero civico, il nome dell'edificio o qualsiasi altra informazione utile a distinguere un indirizzo da un altro. Ora, per ottenere questi dati, utilizzare streetNumber().

Vedi anche ` setStreet()` e ` streetNumber()`.

[since 6.2] QString QGeoAddress::streetNumber() const

Restituisce il numero civico.

Può contenere anche elementi quali il numero di unità, il nome dell'edificio o qualsiasi altra informazione che possa essere utilizzata per distinguere un indirizzo da un altro.

Nota: prima di Qt 6 questa informazione veniva restituita dal metodo street().

Questa funzione è stata introdotta in Qt 6.2.

Vedi anche ` setStreetNumber()` e ` street()`.

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

Sostituisce questo indirizzo con other. Questa operazione è molto veloce e non fallisce mai.

Questa funzione è stata introdotta in Qt 6.2.

QString QGeoAddress::text() const

Restituisce l'indirizzo sotto forma di singola stringa formattata. Si tratta della stringa consigliata da utilizzare per visualizzare l'indirizzo all'utente. In genere assume il formato di un indirizzo riportato su una busta, ma non è detto che sia sempre così.

Il testo dell’indirizzo viene generato automaticamente oppure assegnato esplicitamente. È possibile verificarlo controllando il valore di ` isTextGenerated`.

Se a ` setText()` viene fornita una stringa vuota, allora ` isTextGenerated()` verrà impostato su ` true ` e `text()` restituirà una stringa formattata localmente secondo ` countryCode()` e basata sugli elementi dell’indirizzo quali via, città e così via. Poiché la stringa di testo viene generata dagli elementi dell’indirizzo, una sequenza di chiamate come text(), setStreet(), text() potrebbe restituire stringhe diverse per ogni invocazione di text().

Se a ` setText()` viene fornita una stringa non vuota, allora ` isTextGenerated()` verrà impostato su ` false ` e `text()` restituirà sempre la stringa assegnata esplicitamente. Le chiamate per modificare altri elementi, come ` setStreet()`, ` setCity()` e così via, non influenzeranno la stringa risultante da `text()`.

Vedi anche setText().

[implicit, since 6.2] QGeoAddress &QGeoAddress::operator=(QGeoAddress &other)

La funzione `move` assegna l'oggetto ` other ` a questo indirizzo e restituisce un riferimento a tale indirizzo.

Nota: l'oggetto ` QGeoAddress ` 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.

QGeoAddress &QGeoAddress::operator=(const QGeoAddress &address)

Assegna l'address e specificato a questo indirizzo e restituisce un riferimento a tale indirizzo.

Elementi correlati non membri

[noexcept] size_t qHash(const QGeoAddress &address, size_t seed = 0)

Restituisce il valore hash dell'address, utilizzando l'seed per il calcolo.

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

Restituisce ` true ` se l'indirizzo ` lhs ` non è uguale a ` rhs`, altrimenti restituisce ` false`.

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

Restituisce " true " se l'indirizzo lhs è uguale 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.