Once upon a time, back in the Qt 4 and QtMobility days, there used to be a Location API. Unfortunately, during the transition to Qt 5, this API never managed to get a complete port. Qt Mobility location code was tightly bound to QML1, while Qt 5 introduced QML 2. However if you looked carefully, you may have detected that some QML 2 work had already been done for Qt 5.0. More attention and love was required though. With Qt 5.2 Qt Positioning was released, which was a subset of the Qt 4 Location API offering. It focused on providing the means to determine the geographic position.
Now, with Qt 5.5 the remaining Location APIs are back as a Technology Preview. The main differences between the initial Qt 5.0 work and the current state are the removal of the Qt3D dependencies, updating the map rendering logic and fixing the mouse/touch handling.
The heart of every location offering is accessing and presenting map data. Qt Location builds on top of the Qt Positioning offering and uses Mercator projections for tile -maps. They are rendered using Qt Quick Scene Graph with tiles being simple texture nodes. Users can interact with maps using gestures, insert markers or draw simple geometric objects like rectangles & circles. There are currently three plug-ins providing map data:
In addition, Qt Location provides utilities to find a geographic coordinate based on a street address (geocoding) and navigation routes between two locations. It includes simple driving and walking directions. Everything is exposed with nice and familiar model types in QML, for example GeocodeModel and RouteModel. The obtained navigation data can be presented on the map using the Route type and follows the model-view-delegate pattern. The route instructions can be extracted via the RouteManeuver type. Currently, the HERE and OpenStreetMap plug-in provide support for geocoding and navigation.
Last but not least, there is the Places sub module. It not only provides the means to discover categorized places of interests (POIs) but also presents place details like reviews and associated images. The Places API centers around several QML models with the main two being CategoryModel and PleaseSearchModel. Other features such as search suggestions and reviews are implemented in similar ways. Currently POI functionality is provided by the OpenStreetMap and HERE plug-in.
In summary, QtLocation is back in Qt 5.5. Please checkout our documentation and we are looking forward to your feedback !
Subscribe to our newsletter
Try Qt 6.5 Now!
Download the latest release here: www.qt.io/download.
Qt 6.5 is the latest Long-Term-Support release with all you need for C++ cross-platform app development.
Qt World Summit 2023: Berlin awaits!
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.