Qt位置模块

Qt Location

Qt位置模块

The Qt Location module helps you create mapping solutions using data available from popular location service providers, such as Open Street Map.

​Qt位置模块可帮助使用流行的位置服务提供商(如Open Street Map)提供的数据创建地图解决方案。

The Qt Location API enables you to:

Qt定位API能够:

  • Access and present map data.
  • 访问和显示地图数据。
  • Support touch gesture on a specific area of the map.
  • 支持在地图的特定区域进行触摸手势。
  • Query for a specific geographical location and route.
  • 查询特定的地理位置和路线。
  • Add additional layers on top, such as polylines and circles.
  • 在顶部添加其他图层,如折线和圆。
  • Search for places and related images.
  • 搜索地点和相关图像。

Using the Module

使用模块

QML API

To use the types, add the following import statements to your .qml file:

要使用这些类型,请将以下导入语句添加到.qml文件中:

import QtPositioning
import QtLocation

Note: Many Qt Location QML module APIs are using types from the Qt Positioning module. For example, defining a coordinate to be the center of the map requires types from the Qt Positioning module.

注意:许多Qt位置QML模块API都使用Qt定位模块中的类型。例如,将坐标定义为地图的中心需要Qt定位模块中的类型。

C++ API

For C++ projects, include the header appropriate for the current use case; for example, applications using routes may use:

对于C++项目,包括适合当前用例的头文件;例如,使用路由的应用程序可以使用:

#include <QGeoRoute>

Using a Qt module's C++ API requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake.

​使用Qt模块的C++API需要直接或通过其他依赖关系链接到模块库。一些构建工具对此有专门的支持,包括CMake和qmake。

Building with CMake
使用CMake构建

Use the find_package() command to locate the needed module component in the Qt6 package:

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

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

For more details, see the Build with CMake overview.

​有关更多详细信息,请参阅使用CMake构建概述。

Building with qmake
使用qmake构建

To configure the module for building with qmake, add the module as a value of the QT variable in the project's .pro file:

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

QT += location

Submodules

子模块

The API is split into sub-modules, which provide QML and C++ interfaces for specific purposes. They focus mainly on Map and Place information. The required position data can be retrieved using the QtPositioning module.

​API分为多个子模块,这些子模块为特定目的提供QML和C++接口。他们主要关注地图和地点信息。可以使用QtPosition模块检索所需的位置数据。

Places

地点

The Places submodule is the natural complement to Positioning, providing a source of geographical data about Places of Interest (POI). Besides the source information, the API provides information about the location, size, and other related information about a POI. The Places API can also retrieve images, reviews, and other content related to a place.

地点子模块是定位的自然补充,提供有关兴趣点(POI)的地理数据来源。除了源信息之外,API还提供关于POI的位置、大小和其他相关信息的信息。地点API还可以检索与地点相关的图像、评论和其他内容。

Places introduction:for QMLfor C++

Maps and Navigation

地图和导航

The module provides the QML and C++ alternatives for maps and navigation. The C++ alternative provides utility classes to get geocoding (finding a geographic coordinate from a street address) and navigation (including driving and walking directions) information, whereas its QML counterpart provides UI components to render the information.

该模块为地图和导航提供QML和C++替代方案。C++替代方案提供了实用程序类来获取地理编码(从街道地址中查找地理坐标)和导航(包括驾驶和步行方向)信息,而QML对应方案则提供了UI组件来呈现信息。

Maps and Navigation introduction:for QMLfor C++

Examples

示例

Example Apps

Examples demonstrating use of the Qt Location APIs

演示Qt位置API使用的示例

Maps and Navigation Tutorial

Tutorial introducing the QML Maps Types

QML映射类型介绍教程

API Reference

API参考

The following are lists of the classes and UI components provided by the module, with example applications to demonstrate their usage:

以下是该模块提供的类和UI组件的列表,以及演示其使用的示例应用程序:

QML API Reference

Full list of QML components in the Qt Location API

Qt位置API中QML组件的完整列表

C++ API Reference by domain

Full list of C++ classes and methods of the Qt Location APIs sorted by domain

按域排序的Qt位置API的C++类和方法的完整列表

C++ API Reference

Full list of C++ classes and methods of the Qt Location APIs

Qt位置API的C++类和方法的完整列表

Plugin References and Parameters

插件引用和参数

Information about plugins, important notes on their usage, parameters that can be provided to influence their behavior.

关于插件的信息,关于其使用的重要说明,可以提供的影响其行为的参数。

Qt Location Items Overlay Plugin

Provides an empty map intended to be used as background for an overlay layers for map items.

提供一个空地图,用作地图项目覆盖层的背景。

Qt Location Open Street Map Plugin

Uses Open Street Map and related services.

使用开放式街道地图和相关服务。

Implementing New Back-Ends and Porting

实现新的后端和移植

For systems integrators and distributors, information related to making Qt Location available for a new platform.

对于系统集成商和分销商来说,有关将Qt Location提供给新平台的信息。

GeoServices

Information about the Qt Location GeoServices plugins

Qt位置地理服务插件信息

Places

Information for places backend implementors

后端实现的位置信息

API changes

Information about porting from Qt 5 to Qt 6

关于从Qt 5移植到Qt 6的信息

Licenses

Qt Location is available under commercial licenses from The Qt Company. In addition, it is available under the GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt Licensing for further details.

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值