Address QML Type
The Address QML type represents a specific location as a street address. More...
Import Statement: | import QtPositioning 5.2 |
Since: | Qt 5.2 |
Properties
- address : QGeoAddress
- city : string
- country : string
- countryCode : string
- county : string
- district : string
- isTextGenerated : bool
- postalCode : string
- state : string
- street : string
- text : string
Detailed Description
An Address is used as a unit of data for queries such as (Reverse) Geocoding or Places searches -- many of these operations either accept an Address or return one.
Not all properties of an Address are necessarily available or relevant in all parts of the world and all locales. The district, state and county properties are particularly area-specific for many data sources, and often only one or two of these are available or useful.
The Address has a text property which holds a formatted string. It is the recommended way to display an address to the user and typically takes the format of an address as found on an envelope, but this is not always the case. The text may be automatically generated from constituent address properties such as street, city and and so on, but can also be explicitly assigned. See text for details.
Example Usage
The following code snippet shows the declaration of an Address object.
Address { id: address street: "53 Brandl St" city: "Eight Mile Plains" country: "Australia" countryCode: "AUS" }
This could then be used, for example, as the value of a geocoding query, to get an exact longitude and latitude for the address.
See also QGeoAddress.
Property Documentation
address : QGeoAddress
For details on how to use this property to interface between C++ and QML see "Interfaces between C++ and QML Code".
city : string
This property holds the city of the address as a single formatted string.
country : string
This property holds the country of the address as a single formatted string.
countryCode : string
This property holds the country code of the address as a single formatted string.
county : string
This property holds the county of the address as a single formatted string.
district : string
This property holds the district of the address as a single formatted string.
isTextGenerated : bool
This property holds a boolean that if true, indicates that text is automatically generated from address properties. If false, it indicates that the text has been explicitly assigned.
postalCode : string
This property holds the postal code of the address as a single formatted string.
state : string
This property holds the state of the address as a single formatted string.
street : string
This property holds the street of the address but may also contain things like a unit number, a building name, or anything else that might be used to distinguish one address from another.
text : string
This property holds 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 assigned to text
, then isTextGenerated will be set to true and text
will return a string which is locally formatted according to countryCode and based on the properties of the address. Modifying the address properties such as street, city and so on may cause the contents of text
to change.
If a non-empty string is assigned to text
, then isTextGenerated will be set to false and text
will always return the explicitly assigned string. Modifying address properties will not affect the text
property.
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.9/qml-qtpositioning-address.html