本页内容

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 模块,需要与模块库进行链接,可以直接链接,也可以通过其他依赖项进行链接。一些构建工具对此提供了专门的支持,包括CMake和qmake。

使用 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 概述》。

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