PySide6.QtPositioning.QGeoLocation

class QGeoLocation

QGeoLocation 类表示关于位置的基本信息。更多

概要

方法

注意

本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。

详细描述

一个QGeoLocation由一个坐标和相应的地址组成,还包括一个可选的边界形状,这是在查看位置时建议显示的区域。

__init__()

构造一个新的位置对象。

__init__(other)
Parameters:

其他QGeoLocation

构造一个other的副本

address()
Return type:

QGeoAddress

返回位置的地址。

另请参阅

setAddress()

boundingShape()
Return type:

QGeoShape

返回一个边界形状,表示在查看此位置时建议显示的区域。

例如,建筑物的位置可能有一个以建筑物为中心的区域,但该区域足够大,可以显示其周围的地理环境。

注意

该方法在Qt6中引入,取代了boundingBox()方法。它返回一个QGeoShape而不是QGeoRectangle。使用boundingGeoRectangle()来获取形状的边界QGeoRectangle

另请参阅

setBoundingShape()

coordinate()
Return type:

QGeoCoordinate

返回位置的坐标。

另请参阅

setCoordinate()

extendedAttributes()
Return type:

字典的键类型为 .QString,值类型为 QVariant。

返回与此位置关联的扩展属性。扩展属性依赖于后端,并且可能依赖于位置。

isEmpty()
Return type:

布尔

如果位置坐标是无效的,并且所有其他位置字段为空,则返回true。否则返回false

__ne__(rhs)
Parameters:

rhsQGeoLocation

Return type:

布尔

如果lhs位置不等于rhs,则返回true,否则返回false

__eq__(rhs)
Parameters:

rhsQGeoLocation

Return type:

布尔

如果 lhs 位置等于 rhs,则返回 true,否则返回 false

setAddress(address)
Parameters:

地址QGeoAddress

设置位置的address

另请参阅

address()

setBoundingShape(shape)
Parameters:

形状QGeoShape

设置位置的boundingShape

另请参阅

boundingShape()

setCoordinate(position)
Parameters:

位置QGeoCoordinate

设置位置的coordinate

另请参阅

coordinate()

setExtendedAttributes(data)
Parameters:

data – 字典,键类型为 .QString,值类型为 QVariant。

使用data中指定的参数设置位置的扩展属性。

另请参阅

extendedAttributes()

swap(other)
Parameters:

其他QGeoLocation