- class QGeoAddress#
The
QGeoAddress
class represents an address of aQGeoLocation
. More…Synopsis#
Methods#
def
__init__()
def
city()
def
clear()
def
country()
def
countryCode()
def
county()
def
district()
def
isEmpty()
def
__ne__()
def
__eq__()
def
postalCode()
def
setCity()
def
setCountry()
def
setCountryCode()
def
setCounty()
def
setDistrict()
def
setPostalCode()
def
setState()
def
setStreet()
def
setText()
def
state()
def
street()
def
streetNumber()
def
swap()
def
text()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
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:- __init__(other)#
- Parameters:
other –
QGeoAddress
Constructs a copy of
other
.- __init__()
Default constructor.
- city()#
- Return type:
str
Returns the city.
See also
- clear()#
Clears all of the address’ data fields.
- country()#
- Return type:
str
Returns the country name.
See also
- countryCode()#
- Return type:
str
Returns the country code according to ISO 3166-1 alpha-3
See also
- county()#
- Return type:
str
Returns the county. The county is considered the second subdivision below country.
See also
- district()#
- Return type:
str
Returns the district. The district is considered the subdivison below city.
See also
- isEmpty()#
- Return type:
bool
Returns whether this address is empty. An address is considered empty if all of its fields are empty.
- isTextGenerated()#
- Return type:
bool
Returns true if
text()
is automatically generated from address elements, otherwise returns false iftext()
has been explicitly assigned.- __ne__(rhs)#
- Parameters:
rhs –
QGeoAddress
- Return type:
bool
Returns
true
iflhs
address is not equal torhs
, otherwise returnsfalse
.- __eq__(rhs)#
- Parameters:
rhs –
QGeoAddress
- Return type:
bool
Returns
true
iflhs
address is equal torhs
, otherwise returnsfalse
.- postalCode()#
- Return type:
str
Returns the postal code.
See also
- setCity(city)#
- Parameters:
city – str
Sets the
city
.See also
- setCountry(country)#
- Parameters:
country – str
Sets the
country
name.See also
- setCountryCode(countryCode)#
- Parameters:
countryCode – str
Sets the
countryCode
according to ISO 3166-1 alpha-3See also
- setCounty(county)#
- Parameters:
county – str
Sets the
county
.See also
- setDistrict(district)#
- Parameters:
district – str
Sets the
district
.See also
- setPostalCode(postalCode)#
- Parameters:
postalCode – str
Sets the
postalCode
.See also
- setState(state)#
- Parameters:
state – str
Sets the
state
.See also
- setStreet(street)#
- Parameters:
street – str
Sets the street name to
street
.Note
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.See also
- setStreetNumber(streetNumber)#
- Parameters:
streetNumber – str
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.
- setText(text)#
- Parameters:
text – str
If
text
is not empty, explicitly assignstext
as the string to be returned bytext()
.isTextGenerated()
will return false.If
text
is empty, indicates thattext()
should be automatically generated from the address elements.isTextGenerated()
will return true.See also
- state()#
- Return type:
str
Returns the state. The state is considered the first subdivision below country.
See also
- street()#
- Return type:
str
Returns the street name.
Note
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.See also
- streetNumber()#
- Return type:
str
Returns the street number.
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.
- swap(other)#
- Parameters:
other –
QGeoAddress
- text()#
- Return type:
str
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()
, thenisTextGenerated()
will be set totrue
and text() will return a string which is locally formatted according tocountryCode()
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()
, thenisTextGenerated()
will be set tofalse
and text() will always return the explicitly assigned string. Calls to modify other elements such assetStreet()
,setCity()
and so on will not affect the resultant string from text().See also