Qt Positioning

Qt Positioning API 憑藉 QML 和 C++ 接口提供位置信息。

目前,API 支持在 Android , iOS , macOS , Linux (使用 GeoClue version 0.12.99 ), Windows (with GPS receivers exposed as a serial port providing NMEA sentences), and WinRT (using Windows.Devices.Geolocation). Note that the WinRT implementation can also be used in Win32 Desktop uses cases if the underlying platform is Windows 10 or later.

概述

The Qt Positioning API gives developers the ability to determine a position by using a variety of possible sources, including satellite, or wifi, or text file, and so on. That information can then be used to for example determine a position on a map. In addition satellite information can be retrieved and area based monitoring can be performed.

快速入門

要加載 Qt Positioning 模塊,添加以下語句到 .qml 文件

import QtPositioning 5.2
					

對於 include 當前使用情況適當 header 的 C++ 工程,例如,使用路由的應用程序可以使用

#include <QGeoCoordinate> 
					

.pro 文件應有 positioning 添加關鍵詞

QT += positioning
					
					

概述

Positioning includes all the functionality necessary to find and work with geographic coordinates. It can use a variety of external sources of information, including GPS. This provides us with a coordinate and altitude for the device with additional features such as speed and direction. This provides the fundamental location information used in the API.

參考

Positioning introduction: for QML for C++
API references: for QML for C++
Position plugins: Qt Positioning service plugins

範例