Location QML Type

The Location type holds location data. 更多...

导入语句: import QtPositioning 6.6

特性

详细描述

Location types represent a geographic "location", in a human sense. This consists of a specific coordinate , an address bounding shape bounding shape represents the recommended region to display when viewing this location.

The Location type is most commonly seen as the contents of a search model such as the GeocodeModel . When a GeocodeModel returns the list of locations found for a given query, it represents these as Location objects.

用法范例

The following example shows a simple Location object being declared:

Location {
    coordinate {
        latitude: -27.3
        longitude: 153.1
    }
    address: Address {
        ...
    }
}
					

特性文档编制

address : 地址

This property holds the address of the location which can be use to retrieve address details of the location.


[since QtPositioning 6.2] boundingShape : geoshape

This property holds the recommended region to use when displaying the location. For example, a building's location may have a region centered around the building, but the region is large enough to show it's immediate surrounding geographical context.

注意: This property's changed() signal is currently emitted only if the whole object changes, not if only the contents of the object change.

注意: This property was introduced in Qt6 instead of boundingBox property. It returns a geoshape 而不是 georectangle 。使用 QGeoShape::boundingGeoRectangle () to obtain a bounding georectangle for the shape.

If you need to convert the returned shape to a specific type, use the type property of geoshape together with convenience methods from QtPositioning like QtPositioning.shapeToRectangle ().

This property was introduced in QtPositioning 6.2.


coordinate : coordinate

This property holds the exact geographical coordinate of the location which can be used to retrieve the latitude, longitude and altitude of the location.

注意: this property's changed() signal is currently emitted only if the whole object changes, not if only the contents of the object change.

location : QGeoLocation

For details on how to use this property to interface between C++ and QML see " Interfaces between C++ and QML Code ".

注意: This property updates the whole geo location information, so using it will result in breaking of all the bindings for all other properties.