W3cubDocs

/Qt

Qt Positioning

The Qt Positioning API provides positioning information via QML and C++ interfaces.

Currently the API is supported on Android, iOS, macOS, Linux, and Windows (with GPS receivers exposed as a serial port providing NMEA sentences or using Windows.Devices.Geolocation).

Overview

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.

Using the Module

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

Building with CMake

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

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

See also the Build with CMake overview.

Building with 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:

QT += positioning

Getting Started

To load the Qt Positioning module, add the following statement to your .qml files

import QtPositioning

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

#include <QGeoCoordinate>

Module Evolution

Changes to Qt Positioning lists important changes in the module API and functionality that were done for the Qt 6 series of Qt.

Licenses

Qt Positioning is available under commercial licenses from The Qt Company. In addition, it is available under free software licenses. Since Qt 5.4, these free software licenses are GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt Licensing for further details.

Articles and Guides

Reference

Examples

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qtpositioning-index.html