变更内容Qt Location
Qt 6 的变更,是出于让该框架更高效、更易于使用的有意识努力。
我们力求在每个版本中保持所有公共 API 的二进制和源代码兼容性。但为了使 Qt 成为更好的框架,某些变更在所难免。
在本主题中,我们总结了Qt Location 中的这些变更,并提供了处理这些变更的指导。
破坏性公共 API 变更
映射
- 已移除了
MapRectangle::backend、MapCircle::backend、MapPolyline::backend和MapPolygon::backend属性。 - 以前与路由相关的 QML 元素类型
Route、RouteSegment和RouteManeuver现在已变为值类型route 、routeSegment 和routeManeuver 。它们不能再作为 QML 中的项实例化,其属性也不能进行绑定。 - 以前与映射相关的 QML 元素类型
MapType和CameraCapabilities现已变为值类型mapType 和cameraCapabilities 。它们不能再作为 QML 中的项进行实例化,且其属性无法进行绑定。 QGeoRouteLeg类及其 QML 对应类RouteLeg已合并为QGeoRoute (以及route 类型)。一条路线可以是多条路线的聚合。- Map 类型现仅提供最基本的功能,不处理用户输入。
MapGestureArea已被移除。MapView 类型可处理基本用户输入,例如点击和拖拽事件。
位置
QPlaceImage、QPlaceEditorial和QPlaceReview类已合并为QPlaceContent 。- QPlaceContent 的 API 已进行调整,以便访问QVariant 值的列表。
- 以前的 QML 元素类型
PlaceUser、PlaceRatings、PlaceAttribute、PlaceIcon、PlaceSupplier和PlaceContactDetail现已成为值类型user 、ratings 、placeAttribute 、icon 、supplier 和contactDetail 。它们不能再作为 QML 中的项进行实例化,且其属性无法进行绑定。
实验性 API
此前处于“labs”状态的功能已被移除。这包括分步导航的实验性框架,以及 MapObjects 抽象层。
后端提供程序 API
后端提供程序 API 不再提供二进制和源代码兼容性保证。
其他 API 变更
本节包含不破坏源代码兼容性的 API 改进。不过,这些改进可能会对应用程序逻辑产生影响,因此了解这些内容仍然很有帮助。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.