QGeoAddress 類錶示地址為 QGeoLocation . 更多...
| 頭: |
#include <QGeoAddress>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Positioning)
target_link_libraries(mytarget PRIVATE Qt6::Positioning)
|
| qmake: |
QT += positioning
|
| QGeoAddress () | |
| QGeoAddress (const QGeoAddress & other ) | |
(從 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 ) |
(從 6.2 起)
void
|
setStreetNumber (const QString & streetNumber ) |
| void | setText (const QString & text ) |
| QString | state () const |
| QString | street () const |
(從 6.2 起)
QString
|
streetNumber () const |
(從 6.2 起)
void
|
swap (QGeoAddress & other ) |
| QString | text () const |
(從 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 ) |
The address' attributes are normalized to US feature names and can be mapped to the local feature levels (for example State matches "Bundesland" in Germany).
The address contains a text () for displaying purposes and additional properties to access the components of an address:
默認構造函數。
構造副本為 other .
[noexcept, since 6.2]
QGeoAddress::
QGeoAddress
(
QGeoAddress
&&
other
)
Constructs a geo address object by moving from other .
注意: The moved-from QGeoAddress object can only be destroyed or assigned to. The effect of calling other functions than the destructor or one of the assignment operators is undefined.
該函數在 Qt 6.2 引入。
[noexcept]
QGeoAddress::
~QGeoAddress
()
銷毀此地址。
返迴城市。
另請參閱 setCity ().
Clears all of the address' data fields.
返迴國傢名稱。
另請參閱 setCountry ().
Returns the country code according to ISO 3166-1 alpha-3
另請參閱 setCountryCode ().
Returns the county. The county is considered the second subdivision below country.
另請參閱 setCounty ().
Returns the district. The district is considered the subdivison below city.
另請參閱 setDistrict ().
Returns whether this address is empty. An address is considered empty if all of its fields are empty.
返迴 true 若 QGeoAddress::text () is automatically generated from address elements, otherwise returns false if text () has been explicitly assigned.
Returns the postal code.
另請參閱 setPostalCode ().
設置 city .
另請參閱 city ().
設置 country 名稱。
另請參閱 country ().
設置 countryCode according to ISO 3166-1 alpha-3
另請參閱 countryCode ().
設置 county .
另請參閱 county ().
設置 district .
另請參閱 district ().
設置 postalCode .
另請參閱 postalCode ().
設置 state .
另請參閱 state ().
Sets the street name to street .
注意: Before Qt6 this could also contain things like a unit number, a building name, or anything else that might be used to distinguish one address from another. Use setStreetNumber () to set this data now.
另請參閱 street () 和 setStreetNumber ().
[since 6.2]
void
QGeoAddress::
setStreetNumber
(const
QString
&
streetNumber
)
Sets the street number to streetNumber .
This may also contain things like a unit number, a building name, or anything else that might be used to distinguish one address from another.
注意: Before Qt6 this information was set by setStreet () 方法。
該函數在 Qt 6.2 引入。
另請參閱 streetNumber () 和 setStreet ().
若 text is not empty, explicitly assigns text as the string to be returned by text (). isTextGenerated () 將返迴 false。
若 text is empty, indicates that text () should be automatically generated from the address elements. isTextGenerated () will return true.
另請參閱 text ().
Returns the state. The state is considered the first subdivision below country.
另請參閱 setState ().
Returns the street name.
注意: Before Qt6 this could also contain things like a unit number, a building name, or anything else that might be used to distinguish one address from another. Use streetNumber () to obtain this data now.
另請參閱 setStreet () 和 streetNumber ().
[since 6.2]
QString
QGeoAddress::
streetNumber
() const
返迴街道編號。
This may also contain things like a unit number, a building name, or anything else that might be used to distinguish one address from another.
注意: Before Qt6 this information was returned by street () 方法。
該函數在 Qt 6.2 引入。
另請參閱 setStreetNumber () 和 street ().
[noexcept, since 6.2]
void
QGeoAddress::
swap
(
QGeoAddress
&
other
)
Swaps this address with other 。此操作很快且從不失敗。
該函數在 Qt 6.2 引入。
Returns the address as a single formatted string. It is the recommended string to use to display the address to the user. It typically takes the format of an address as found on an envelope, but this is not always necessarily the case.
The address text is either automatically generated or explicitly assigned. This can be determined by checking isTextGenerated .
If an empty string is provided to
setText
(),然後
isTextGenerated
() 會被設為
true
and text() will return a string which is locally formatted according to
countryCode
() and based on the elements of the address such as street, city and so on. Because the text string is generated from the address elements, a sequence of calls such as text(),
setStreet
(), text() may return different strings for each invocation of text().
If a non-empty string is provided to
setText
(),然後
isTextGenerated
() 會被設為
false
and text() will always return the explicitly assigned string. Calls to modify other elements such as
setStreet
(),
setCity
() and so on will not affect the resultant string from text().
另請參閱 setText ().
[default, since 6.2]
QGeoAddress
&QGeoAddress::
operator=
(
QGeoAddress
&
other
)
Move-assigns the other to this address and returns a reference to this address.
注意: The moved-from QGeoAddress object can only be destroyed or assigned to. The effect of calling other functions than the destructor or one of the assignment operators is undefined.
該函數在 Qt 6.2 引入。
賦值給定 address to this address and returns a reference to this address.
[noexcept]
size_t
qHash
(const
QGeoAddress
&
address
,
size_t
seed
= 0)
返迴哈希值為 address ,使用 seed for the calculation.
返迴
true
if
lhs
address is not equal to
rhs
,否則返迴
false
.
返迴
true
if
lhs
address is equal to
rhs
,否則返迴
false
.