A phone usually has a built-in GPS modem but also other sources of positioning information, so I will use Android for this example. The main Qt classes we will look at are as follows:
Here are the Qt Positioning APIs:
QGeoSatelliteInfo
QGeoLocation
QGeoPositionInfoSource
QGeoCoordinate
And here are the Qt Location APIs:
QPlaceSearchResult
QPlaceContent
QGeoRoute
First, we need to edit the .pro
file and add QT += positioning
.
You can show the user satellite information by using QGeoSatelliteInfoSource
, which has a static
method to get QGeoSatelliteInfoSource.
Note
The source code can be found on the Git repository under the Chapter08-1
directory, in the cp8
branch.
We will start by calling QGeoSatelliteInfoSource::createDefaultSource
.
QGeoSatelliteInfoSource*source = QGeoSatelliteInfoSource::createDefaultSource(this);