Qt Positioning C++ Classes

定位模块通过 QML 和 C++ 接口提供定位信息。更多

QGeoAddress

代表 QGeoLocation 的地址

QGeoAreaMonitorInfo

描述要监测的邻近区域的参数

QGeoAreaMonitorSource

可检测指定坐标集的邻近性变化

QGeoCircle

定义一个圆形地理区域

QGeoCoordinate

定义地球表面的地理位置

QGeoLocation

代表位置的基本信息

QGeoPath

定义地理路径

QGeoPolygon

定义地理多边形

QGeoPositionInfo

包含特定时间点收集的全球位置、方向和速度信息

QGeoPositionInfoSource

位置更新分发的抽象基类

QGeoPositionInfoSourceFactory

工厂类,用作外部定位数据提供者的插件接口

QGeoRectangle

定义一个矩形地理区域

QGeoSatelliteInfo

包含卫星的基本信息

QGeoSatelliteInfoSource

用于分发卫星信息更新的抽象基类

QGeoShape

定义一个地理区域

QNmeaPositionInfoSource

使用 NMEA 数据源的定位信息

QNmeaSatelliteInfoSource

使用 NMEA 数据源的卫星信息

详细说明

要加载Qt Positioning 模块,请在 .qml 文件中添加以下语句

import QtPositioning

对于 C++ 项目,请加入适合当前用例的头文件,例如,使用路线的应用程序可以使用

#include <QGeoCoordinate>

使用模块

使用 Qt 模块需要直接或通过其他依赖关系与模块库链接。有几种构建工具为此提供了专门支持,包括CMakeqmake

使用 CMake 构建

使用find_package() 命令在Qt6 软件包中找到所需的模块组件:

find_package(Qt6 REQUIRED COMPONENTS Positioning)
target_link_libraries(mytarget PRIVATE Qt6::Positioning)

使用 qmake 构建

要配置使用 qmake 构建的模块,请在项目的 .pro 文件中添加模块作为QT 变量的值:

QT += positioning

更多信息请参阅Qt Positioning 概述

© 2025 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.