The Qt Positioning API provides positioning information via QML and C++ interfaces.
目前,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.11
For C++ projects include the header appropriate for the current use case, for example applications using routes may use
#include <QGeoCoordinate>
.pro 文件应有 positioning 添加关键词
QT += positioning
Qt Positioning 在商业许可下是可用的来自 Qt 公司 。此外,它在自由软件许可下也是可用的。从 Qt 5.4 起,这些自由软件许可是 GNU LGPL (次一般公共许可) 第 3 版 ,或 GNU GPL (一般公共许可) 第 2 版 。见 Qt 许可 进一步了解细节。
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 |